What are common pitfalls when implementing DI?
- Over-injection (too many dependencies in one class – violates SRP)
- Service locator anti-pattern
- Incorrect lifetimes, leading to memory leaks or unintended reuse
- Tight coupling to the DI container (e.g., using container APIs in business logic)
- Circular dependencies due to poor design
- Registering services in the wrong order or not at all