How do you design an application to prevent the DI container from becoming a God Dependency?

Updated Apr 28, 2026

Short answer

Applications should follow the Hollywood Principle: 'Don't call us, we'll call you.' Business logic should never reference the DI container directly.

Deep explanation

If your domain objects reference IServiceProvider or Container, your domain is tightly coupled to infrastructure. Instead, push all DI logic to the absolute outermost layer (Composition Root, APIs, Background Workers). The inner layers should only consist of plain classes (POCOs/POJOs) with explicit constructor dependencies.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Dependency Injection interview questions

View all →