Skip to content
Sharp

Dependency Injection · interview question

Why is field injection a design problem?

Multiple choiceMediumchapter-9-curatedpremiumdependency-injectionconstructor-vs-field-injection
Choose one answer
Answer and explanation

Correct answer

B. It hides dependencies and makes the class harder to test directly

Why

Field injection makes dependencies less visible and usually pushes tests toward framework-heavy setup. Constructor injection exposes the collaboration graph and makes the class easier to instantiate safely.

Test yourself on Dependency Injection

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

Start free test
All Dependency Injection questions →