CodeZettaInterview Hub

NestJS · Dependency Injection · Mid-Level · Comparison

Constructor injection vs @Inject() property injection?

Short Interview Answer

Prefer constructor injection for required deps and testability; property injection is rarer.

Detailed Explanation

Constructor makes dependencies explicit and immutable-friendly. Property injection complicates reasoning.

Did you know this answer?