Class DependencyContainer

The dependency container maintains all dependencies registered with it.

class DependencyContainer ;

Dependencies registered by a container can be resolved as long as they are still registered with the container. Upon resolving a dependency, an instance is fetched according to a specific scope which dictates how instances of dependencies are created. Resolved dependencies will be autowired before being returned.

In most cases you want to use a global singleton dependency container provided by getInstance() to manage all dependencies. You can still create new instances of this class for exceptional situations.

Methods

NameDescription
clearAllRegistrations Clears all dependency registrations managed by this container.
register Register a dependency by concrete class type.
register Register a dependency by super type.
removeRegistration Removes a registered dependency by type.
resolve Resolve dependencies.
resolve Resolve dependencies using a qualifier.
resolveAll Resolve all dependencies registered to a super type.
setPersistentRegistrationOptions Apply persistent registration options which will be used everytime register() is called.
setPersistentResolveOptions Apply persistent resolve options which will be used everytime resolve() is called.
unsetPersistentRegistrationOptions Unsets all applied persistent registration options
unsetPersistentResolveOptions Unsets all applied persistent resolve options