What does singleton scope mean in Spring?
Strong answer
It means one bean instance per application context, not one object for every JVM or every request. Singleton beans should be designed to be stateless or thread-safe when accessed concurrently.
Learn bean scopes, lifecycle, profiles, configuration classes, events, interceptors, and AOP trade-offs.
Spring · container
Use the strong answer as your reference, explain it aloud in your own words, then choose how soon you want to review it again.
Interview prompt
Strong answer
Bean definitions describe how the container creates and manages objects. Profiles and configuration properties separate environment concerns from code. AOP can centralize cross-cutting behavior such as transactions or logging, but proxy-based behavior has boundaries and should not hide important domain logic.
Key points
Interviewer looks for
Mention proxy boundaries, lifecycle, profiles, and why configuration should remain observable and testable.
Java example
1@Configuration
2class AppConfig {
3 @Bean
4 Clock clock() { return Clock.systemUTC(); }
5}Topic interview questions
These questions are tied to this lesson. Read each question aloud, then compare your explanation with the strong answer.
Strong answer
It means one bean instance per application context, not one object for every JVM or every request. Singleton beans should be designed to be stateless or thread-safe when accessed concurrently.
Strong answer
Initialization callbacks prepare a fully constructed bean, and destruction callbacks release resources when the context closes. They should manage lifecycle concerns, not contain the core business workflow.
Strong answer
Profiles select environment-specific bean definitions or configuration, such as local, test, and production integrations. They should not hide major business behavior or become an unmanageable collection of branching rules.
Strong answer
Spring commonly applies advice through a proxy. A method calling another method on the same this reference does not pass through the proxy, so the intercepting advice is not invoked.
Strong answer
AOP is useful for consistent cross-cutting policies such as transactions, metrics, tracing, and security. Core domain decisions should remain visible in ordinary code so they are easy to understand and test.
How well do you know this?
Your review choice is saved locally and synced to your learner profile when signed in.