DependencyContainer.register

Register a dependency by concrete class type.

A dependency registered by concrete class type can only be resolved by concrete class type. No qualifiers can be used when resolving dependencies which are registered by concrete type.

The default registration scope is "single instance" scope.

  1. Registration register(RegistrationOption options)
    class DependencyContainer
  2. Registration register(RegistrationOption options)

Return Value

A registration is returned which can be used to change the registration scope.

Examples

Register and resolve a class by concrete type:

class Cat : Animal { ... }
container.register!Cat;

See Also

singleInstance, newInstance, existingInstance

Meta