When several parts of an application need the same Spring-managed object, singleton scope lets them share it. A bean is an object managed by Spring, and singleton is its default scope: each reference to a particular singleton bean returns the same instance within the context. section 5.0 section 5.1
Singleton does not mean there can be only one instance of a class in the application. A Spring context can contain multiple singleton beans of the same type under different names. Each name refers to its own shared instance. section 5.1
Requesting the same bean twice
Declare a CommentService with an @Bean method named commentService. Spring uses the method name as the bean name. If c is the application context, compare c.getBean("commentService", CommentService.class) with a second identical lookup using ==: the result is true because both references point to the same instance. Singleton behavior also applies to beans declared with stereotype annotations such as @Service and @Repository. section 5.1
Figure 5.4 The beans are also singleton-scoped when using stereotype annotations to create them. When using @Autowired to request Spring to inject a bean reference, the framework injects the reference to the singleton bean in all the requested places.

The diagram shows two services receiving a reference to the same singleton repository through dependency injection. section 5.1
By default, Spring creates singleton beans when the context starts. You can instead configure a singleton for lazy instantiation, so Spring creates it when first used. section 5.4
Because multiple threads may use the same singleton, prefer immutable beans. If threads change shared state, a race condition can produce unexpected results; a mutable singleton needs its own thread-safety measures. Constructor injection allows dependencies to be assigned to final fields, helping make the instance immutable. section 5.1.1
For an object that needs mutable state per use, consider prototype scope: Spring creates a new instance for each request. First ask whether the object needs to be a Spring bean at all. Also, injecting a prototype into a singleton only supplies it once, when the singleton is created; the singleton then keeps that same instance. section 5.2.1 section 5.4
