title: Spring Prototype-Bean Provider without @Autowired
body: <p>I have a prototype Bean which is instantiated by singleton bean with a <code>Provider</code>:</p>
  
  <pre><code>@Component
  @Scope("prototype")
  class MyPrototype {}
  
  @Component
  class MySingleton {
      @Autowired
      javax.inject.Provider&lt;MyPrototype&gt; prototypeFactory;
  }
  </code></pre>
  
  <p>This works fine, but our company rules state that <code>@Autowired</code> is not allowed; the common pattern is <code>@Resource(SingletonBeanClass.BEAN_ID)</code>.</p>
  
  <p>Is it possible to annotate the <code>Provider</code> this way so the Spring lookup can create it? </p>
  
  <p>I'm aware I can add a factory method with <code>@Lookup</code>, or a singleton factory bean, but I prefer the <code>Provider</code>.</p>
  
  <p>EDIT:
  I didn't get it to work this way and in the end had to edit <code>spring.xml</code>; see below for details.</p>