Handling transient faults in infrastructure injected via DI.

Updated Apr 28, 2026

Short answer

When injecting third-party clients (HTTP, DB), transient faults (timeouts, 503s) are inevitable. Resilience must be woven into the DI layer.

Deep explanation

Using the Decorator pattern or native HTTP client factories, you can wrap the raw infrastructure dependency with a resilience policy (like Polly in C# or Resilience4j in Java). The consumer requests the interface, but receives a proxy that automatically executes retries, circuit breaking, and fallback logic without muddying the consumer's logic.

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 →