Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (36 sloc) 1.38 KB

Structure of Dependency Injector

Current section describes Dependency Injector main entities and their interaction between each other.

/images/internals.png

There are 2 main entities: providers & containers.

Providers

Providers are strategies of accessing objects. For example, :py:class:`dependency_injector.providers.Factory` creates new instance of provided class every time it is called. :py:class:`dependency_injector.providers.Singleton` creates provided instance once and returns it on every next call. Base class is - :py:class:`dependency_injector.providers.Provider`.

Providers could be:

  • Injected into each other.
  • Overridden by each other.
  • Extended.

Containers

Containers are collections of providers. They are used for grouping of providers by some principles. Base class is - :py:class:`dependency_injector.containers.DeclarativeContainer`.

Containers could be:

  • Overridden by each other.
  • Copied from each other.
  • Extended.
.. disqus::