Bean Scopes
Singleton, prototype, request, and session scopes.
What a Scope Controls
A bean’s scope determines how many instances the container creates and how long each lives. The default and most common scope is singleton.
Choosing the right scope matters for state, memory, and thread safety.
Singleton Scope
With singleton scope, the container creates exactly one instance per ApplicationContext and returns it for every injection point. This is ideal for stateless services.
@Service // singleton by default
public class PricingService {
public BigDecimal price(Order o) { /* stateless */ }
}