• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Core Container dependency Injection Behaviour?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As core container inject the dependency with bean id defined in spring-config.xml. My question can configure the objects here which are
holding some state? I mean two request comes for the same object at same time , will container create the new instances for both of them
if the scope is prototype? Last question is does container maintain some pool for the created objects or they are good for garbage collection
as soon as they are finished?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you set the scope to "prototype" everytime someone calls getBean() will get a new instance. However, typically, most beans are objects that do not hold state and having a single instance only is plenty to support many clients all at the same time. There would be no thread issues. Spring does not pool objects, there is no need for pools of Spring beans.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic