beginnerSpring Fundamentals

What is the default scope of a Spring Bean, and what other scopes are available?

The default scope is singleton — the container creates exactly one shared instance of the bean for the entire application context, and every injection point receives that same instance. Other scopes include prototype (a new instance every time the bean is requested), and web-specific scopes like request and session that tie a bean's lifetime to an HTTP request or session.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How do you handle global exceptions in Spring Boot? Explain @ControllerAdvice.← Back to all Spring Boot & Microservices questions