[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"glossary-dependency-injection::en":3,"gloss-cluster-dependency-injection::en":23,"gloss-next-dependency-injection::en":9},{"slug":4,"category":5,"name":6,"definition":7,"meta_desc":8,"faq":9,"schema_markup":9,"related":10},"dependency-injection","dev-tools","Dependency Injection","Dependency injection (DI) is a design pattern where an object receives the things it depends on from the outside — passed into its constructor or method — instead of creating them itself. Rather than a service reaching out to instantiate its own database connection or HTTP client, those dependencies are \"injected\" by the caller or a DI container. The payoff is decoupling and testability: because the dependency is supplied externally, you can swap the real database for a mock in tests, or switch implementations without touching the class that uses it. DI is central to frameworks like Spring, Angular, NestJS, and Laravel's service container. For AI\u002FSaaS builders, DI is what makes a codebase testable and configurable — you can point the same code at a real LLM provider in production and a fake one in tests, or swap providers via config. Practical note: DI adds indirection, so don't over-engineer a tiny script with a full container; reach for it when you have real seams you need to swap or test across.","Dependency injection passes an object the things it depends on from outside instead of letting it construct them — the pattern that makes code testable.",null,[11,14,17,20],{"slug":12,"name":13},"mocking","Mocking (Test Doubles)",{"slug":15,"name":16},"sdk","Software Development Kit (SDK)",{"slug":18,"name":19},"type-safety","Type Safety",{"slug":21,"name":22},"unit-test","Unit Test",[24,28,31,35,38,41,44,47,50,53,56,59],{"slug":25,"category":5,"name":26,"updated_at":27},"agent","Agent","2026-08-24T02:46:36+00:00",{"slug":29,"category":5,"name":30,"updated_at":27},"ai-code-assistant","AI Coding Assistant",{"slug":32,"category":5,"name":33,"updated_at":34},"api-gateway","API Gateway","2026-08-24T02:46:37+00:00",{"slug":36,"category":5,"name":37,"updated_at":34},"api-versioning","API Versioning",{"slug":39,"category":5,"name":40,"updated_at":27},"autonomous-agent","Autonomous Agent",{"slug":42,"category":5,"name":43,"updated_at":34},"blue-green-deployment","Blue-Green Deployment",{"slug":45,"category":5,"name":46,"updated_at":34},"canary-deployment","Canary Deployment",{"slug":48,"category":5,"name":49,"updated_at":34},"chaos-engineering","Chaos Engineering",{"slug":51,"category":5,"name":52,"updated_at":27},"ci-cd","Continuous Integration \u002F Continuous Deployment (CI\u002FCD)",{"slug":54,"category":5,"name":55,"updated_at":34},"circuit-breaker","Circuit Breaker",{"slug":57,"category":5,"name":58,"updated_at":34},"cli","Command-Line Interface (CLI)",{"slug":60,"category":5,"name":61,"updated_at":34},"cloud-development-environment","Cloud Development Environment (CDE)"]