Skip to content
Sharp

Spring Core · interview question

Why might you choose prototype scope for a Spring bean in a multi-threaded environment?

Multiple choiceMediumchapter-9-curatedpremiumspring-corecontrollers-services-repositories
Choose one answer
Answer and explanation

Correct answer

B. To ensure each thread gets a new instance

Why

Prototype scope is used to create a new bean instance each time it is requested, which is useful in multi-threaded environments where each thread needs its own instance to avoid shared state issues.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →