The default bean scope in the Spring Framework is Singleton. When a bean is defined without specifying a scope, Spring creates only one instance of that bean and shares it throughout the entire application context.
Key Points: • Singleton is the default scope for all Spring beans. • Only one bean instance is created per Spring IoC container. • The same bean instance is returned whenever it is requested. • Singleton scope is ideal for stateless components such as services, repositories, and utility classes. • Using a single shared instance helps reduce memory consumption and improves performance.
Example: If a UserService bean is configured with the default scope, Spring creates only one instance of UserService and shares it across all components that depend on it.
Code Example:
@Service
public class UserService {
}Interview Tip: A concise interview answer is:
"The default bean scope in Spring is Singleton. Spring creates a single instance of the bean per application context and shares that instance throughout the application."