I want to know , Is spring dependency injection create singleton object ? If yes how it manage internally? ..
I want to know at what time this singleton object is created and destroy.
I want to know , Is spring dependency injection create singleton object ? If yes how it manage internally? ..
I want to know at what time this singleton object is created and destroy.
By default, Spring beans are basically singletons. Spring will create a single instance of each of your classes, and it will generally do this when Spring is initialized.
However, this is nearly infinitely customizable. Spring can also create a new instance of a bean whenever you ask for that bean by name, or it can create beans for the length of a request, or it can use a singleton but not instantiate it until the first time you invoke it, or several other things.
The discussion of when beans are instantiated and how long they last is a discussion of a bean's "Scope". Check it out in the documentation: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-scopes