Dependency injection
Meaning in software engineering, with examples
In software engineering, dependency injection means: A technique where an object receives the things it needs, such as a database client, from outside instead of creating them itself, which makes code easier to test.
In Turkish: bağımlılık enjeksiyonu, bağımlılıkların dışarıdan verilmesi
How it is used
Often shortened to DI. Frameworks such as Spring, ASP.NET Core and Angular have built-in DI containers. With dependency injection, tests can pass in a mock instead of the real service. You inject a dependency, often through the constructor.
Example sentences
Thanks to dependency injection, the tests use a fake payment client instead of the real one.
Don't create the logger inside the class; use dependency injection and pass it in.
Common collocations
- DI container
- constructor injection
- inject a dependency
- use dependency injection
Related terms
More terms: Architecture, Design Patterns and Graphics
Practise with graded reading
Reading at the right level is the fastest way to make new words stick. Pick free English books by level:
