title: How to migrate bean "with additional parameters" using @Assisted from Guice to Spring?
body: <p>I'm working in a project that was implemented using Guice but we need to migrate it to Spring 3.x and we have this use-case below where beans need additional parameters for creation. How is this implemented in Spring? is it possible to implement using only annotations (and no xml)?</p>
  
  <pre><code>import com.google.inject.AbstractModule;
  import com.google.inject.assistedinject.FactoryModuleBuilder;
  import com.google.inject.assistedinject.Assisted;
  
  import javax.inject.Inject;
  
  public class MyModule extends AbstractModule {
      @Override
      protected void configure() {
          super.binder().install(new FactoryModuleBuilder().
                  implement(Car.class, CarImpl.class).
                  build(CarFactory.class));
      }
  }
  
  public interface Car {
      String getBrand();
      String getModel();
  }
  
  public class CarImpl implements Car {
      public CarImpl(@Assisted("brand") String brand, @Assisted("model") String model) {
          this.brand = brand;
          this.model = model;
      }
  
      @Override
      String getBrand() { return brand; }
  
      @Override
      String getModel() { return model; }
  
      private final String brand;
      private final String model;
  }
  
  public interface CarFactory {
      Car create(@Assisted("brand") String brand, @Assisted("model") String model);
  }
  
  public class Client {
      @Inject CarFactory carFactory;
      final Car myCar;
  
      public Client() {
          myCar = carFactory.create("BMW", "530d xDrive");
      }
  
      void driveIt() { /* don't crash it */ }
  
      public static void main(String[] args) {
          new Client().driveIt();
      }
  }
  </code></pre>