title: Spring autowiring with bean scope of prototype
body: <p>I have a question in spring with autowire with a bean which is having a scope of prototype..
  So basically i am writing a code which is spring with JPA.So i am autowiring my entity manager in my DAO layer .I am loading the entitymanager from a class by using the @configuraion Annotation .</p>
  
  <pre><code>@Configuration
  public class DALConfigurationLoader {
  
  
      @Bean
      @Scope("prototype")
      public EntityManager getEntityManager() {
  }
  </code></pre>
  
  <p>When i do this i am expecting that for every request it should get a new bean .</p>
  
  <pre><code>@Component
  public class OfferPriceDomainDAOImpl  {
  
  
  
      @Autowired
      private EntityManager entityManager;
          public OfferPrice getOfferPrice(String offer_Price_Id) throws DataAccessException{
             //use entitymanager here 
          }
  
     }
  </code></pre>
  
  <p>In this case it is a single entity manager for all the request which is wrong.i want each method should get a new entity manager .As based on the jpa specification every new request should process a new entity manager...How can i autowire a bean with a scope of prototype..</p>
  
  <p>I would really appreciate if some one can answer my question..</p>
  
  <p>Thank,
  Swati</p>