beginnerSpring Core Annotations

What does the @Scope annotation do, and what scopes can you specify with it?

@Scope overrides a bean's default lifecycle/visibility — common values are "singleton" (one shared instance, the default), "prototype" (a new instance per request for the bean), and, in a web application, "request" or "session" (tied to the HTTP request or session lifetime). It's applied directly on a @Component class or an @Bean method when the default singleton behavior isn't what you want.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What does the @Scope annotation do, and what scopes can you specify with it?

Next Step

Continue to What is the difference between session.get() and session.load()?← Back to all Spring Boot & Microservices questions