Bean scope in Spring defines the lifecycle and visibility of a bean within the Spring IoC container. It determines how many bean instances are created and how long those instances remain available.
A UserService bean is typically configured as Singleton because it can be shared across the application. A ShoppingCart bean is often configured as Session scope because each user should have a separate cart.
@Component
@Scope("prototype")
public class UserBean {
}A concise interview answer is
Spring provides several bean scopes, including Singleton, Prototype, Request, Session, Application, and WebSocket. Singleton is the default scope and creates one shared bean instance per Spring container, while other scopes create beans based on specific application contexts.
Last updated: 16 July 2026
Previous question: What is the difference between constructor injection and setter injection?
Next question: When would you use singleton scope and when prototype scope in Spring?