Skip to main content

Dependency Injection (Software Design)

Dependency Injection (DI) is a design pattern that helps with decoupling dependencies.

With DI, clients which depend on a given type do not know that a specific instance of this type exists, instead this information is provided by configuring the client with a specific instance of this type. This instance is usually determined during runtime (or during compile time).

Clients are only aware of the type and the available operations of this given type, i.e. its interface.

DI serves as a realization for the Dependency Inversion Principle.