When would you use singleton scope and when prototype scope in Spring?

Singleton and Prototype are two commonly used Spring bean scopes. The choice between them depends on whether the application requires a shared instance or a new instance for each request.

Key Points

Example

@Component
@Scope("singleton")
public class UserService {
}

@Component
@Scope("prototype")
public class ReportGenerator {
}

Interview Tip

A concise interview answer is

Use Singleton scope when a single shared instance is sufficient for the entire application, such as service or repository beans. Use Prototype scope when a new object is required for every request, especially for stateful components that should not be shared.

Last updated: 11 November 2026

Previous question: What are the different bean scopes in Spring?

Next question: What is the default bean scope in the Spring Framework?

More Spring Framework - Level I interview questions

All Spring Framework - Level I questions