DependencyContainer.resolve

Resolve dependencies using a qualifier.

Dependencies can only resolved using this method if they are registered by super type.

Resolved dependencies are automatically autowired before being returned.

  1. RegistrationType resolve(ResolveOption resolveOptions)
  2. QualifierType resolve(ResolveOption resolveOptions)
    class DependencyContainer
    public
    QualifierType
    resolve
    (
    RegistrationType
    QualifierType : RegistrationType
    )
    if (
    !is(QualifierType == struct)
    )

Return Value

Type: QualifierType

An instance is returned which is created according to the registration scope with which they are registered.

Throws

ResolveException when type is not registered or there are multiple candidates available for type.

Examples

Resolve dependencies registered by super type:

class Cat : Animal { ... }
class Dog : Animal { ... }

container.register!(Animal, Cat);
container.register!(Animal, Dog);

container.resolve!(Animal, Cat);
container.resolve!(Animal, Dog);

Meta