Skip to content
Sharp

Spring Core · interview question

Which bean scope should you use for a Spring bean that needs to maintain state across a web session?

Multiple choiceMediumchapter-9-curatedpremiumspring-corepersistence-and-validation
Choose one answer
Answer and explanation

Correct answer

C. Session

Why

The session scope is appropriate for beans that need to maintain state across multiple HTTP requests within a web session. This scope ties the lifecycle of the bean to that of an HTTP session.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →