Skip to content
Sharp

Spring Core · interview question

Why might constructor injection be preferred over field injection in Spring?

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

Correct answer

D. It makes dependencies explicit

Why

Constructor injection is preferred because it makes dependencies explicit and supports immutability by requiring all dependencies to be provided at object creation, enhancing testability and clarity.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →