Skip to content
Sharp

Spring Core · interview question

Which Bean scope should be used for a component that needs to maintain user session data?

Multiple choiceHardchapter-9-curatedpremiumspring-coredtos-and-entities
Choose one answer
Answer and explanation

Correct answer

A. Session

Why

The Session scope is used for components that need to maintain state across multiple HTTP requests within a user session. It is suitable for storing user session data because it is created once per session and lasts until the session ends.

Test yourself on Spring Core

A free test with instant, explained results. No account needed.

Start free test
All Spring Core questions →