File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Core Container  dependency  Injection Behaviour? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Core Container  dependency  Injection Behaviour?" Watch "Core Container  dependency  Injection Behaviour?" New topic
Author

Core Container dependency Injection Behaviour?

scott miles
Ranch Hand

Joined: Jun 16, 2011
Posts: 70
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?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Core Container dependency Injection Behaviour?
 
Similar Threads
Spring core container is the basis for complete Spring framework?
Spring/Struts/EJB?
what is framework and what is container? is my understanding right?
Attributes for ServletConfig & ServletContext through web.xml
What is dependency?