title: spring: how to use non-default constructor when auto-wiring a prototype bean using @Autowired and context:component-scan?
body: <p>Suppose you have a prototype bean class as below:</p>
  
  <pre><code>@Component
  @Scope("prototype")
  public class Foobar {
      private String foo;
      public Foobar( String foo ) {
          this.foo = foo;
      }
  }
  </code></pre>
  
  <p>So, is it possible to use <code>@Autowired</code> to wire such a bean in another class, which should use the non-default constructor <code>Foobar(String foo)</code> to instantiate the bean?</p>
  
  <p><strong>update</strong><br>
  In the example above, the constructor parameter, <code>String foo</code>, is not available from application context but rather dynamic. So, having the constructor annotated with <code>@Autowired</code> and then specifying <code>foo</code> somewhere in the context doesn't seem an ideal solution here.</p>