title: Spring Dependency injection scope confusion
body: <p>I am new to Spring DI and i am implimenting DI for the first time in my webapplication.
  it seems i am doing somehing wrong and it related the way i am using spring scope.here is my problem
  i have a serive class where i am injecting various other object in order to achieve the desired functionality
  here is my spring file entries</p>
  
  <pre><code>&lt;bean id="ImportServiceImpl" class="ImportServiceImpl" factory-method="getInstance"&gt;
          &lt;property name="browseDirectory" ref="browseDirectoryImpl"/&gt;
          &lt;property name="xmlUnmarshaller" ref="xmlUnmarshallerImpl"/&gt;
          &lt;property name="Adaptar" ref="AdaptarImpl"/&gt;
          &lt;property name="DAOService" ref="DAO"/&gt;
       &lt;/bean&gt;
  
       &lt;bean id="browseDirectoryImpl" class="BrowseDirectoryImpl" factory-method="getInstance" /&gt;
       &lt;bean id="xmlUnmarshallerImpl" class="XMLUnmarshallerImpl"/&gt;
       &lt;bean id="AdaptarImpl" class="AdaptarImpl" factory-method="getInstance"/&gt;
  </code></pre>
  
  <p>now in my adaptarImpl class i have a refrence to some other object which is being initialized in the constructor </p>
  
  <pre><code>private AdaptarImpl(){
      foo=new Foo();
  }
  </code></pre>
  
  <p>now for the first time when the server start and this service run fist time everything is fine foo is being initilized to its proper initialization value but for all other subsequent calls Spring is returing refrence to the previous initialized foo object where i want that for each new request a new instance of foo should be created.
  it apperas to me that the factory method being used in the above code <code>factory-method="getInstance"</code>
  is being called only once when server called and all other subsequent calles returning same refrence where i want a new instance for every request.
  here is my facory method</p>
  
  <pre><code>public static ImportServiceImpl getInstance(){
      return new ImportServiceImpl();
  }
  </code></pre>
  
  <p>i know i am doing basics wrong in DI but not sure where it is.I am using Struts2 for MVC and for service layer using Spring DI
  any help in this regard will  be helpful</p>
  
  <p>Thanks
  Umesh</p>