By default all beans in Spring are singletons. To have a bean which will not be instantiated as a singleton, use singleton="false" in the configuration of the bean.
Your gains with Singleton injection
So, when using Singleton injection these are your gains:
* Reduced configuration and less code (inject once use everywhere)
* Injected Singletons can be used in classes that are not part of the beanwiring chain
* Static methods can use injected Singletons
* Injected Singletons can serve as beanwiring starting points
* Increased productivity (instant usage of injected code)
Remember that this singleton is for that spring factory only. There can be following possibilities:
- Another bean with same name in a different factory.
- bean with different name and same class
- an object instantiated of the same class outside the factory.
This singleton is different from what we understand as singleton pattern. For a discussion see at Spring Beans section at Spring Tutorial