Skip to content
Sharp

Spring Core · interview question

Which of the following best describes constructor injection in Spring?

Multiple choiceMediumchapter-9-curatedpremiumspring-coreapplication-properties
Choose one answer
Answer and explanation

Correct answer

D. It is the preferred method for mandatory dependencies.

Why

Constructor injection is preferred for mandatory dependencies because it ensures that required dependencies are not null and are provided at the time of object creation.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →