autowire

Autowire a constructor, field or a method.

Autowire a constructor, field or a method. To autowire a constructor simply call autowire with no template arguments. For autowiring a field or a method, call autowire with the name of field or argument as first template argument. Autowiring process will attempt to find all parameters by their name first, and by type afterwards, in order to inject the dependencies into the component. Failing to find a suitable candidate for injection, will fail in an exception during container instantiation. Note: There are no guarantees as of which method or constructor from an overload set will be selected as such it is advised to use autowire only on members that are not part of an overload set.

  1. Z autowire(Z factory)
    @safe
    Z
    autowire
    (
    Z : InstanceFactoryAware!T
    T
    )
    if (
    getMembersWithProtection!(T, "__ctor", "public").length > 0
    )
  2. Z autowire(Z factory)
  3. Z autowire(Z factory)

Parameters

T

the component type

factory Z

ConfigurationContextFactory where to inject the constructor or method configurer

Return Value

Type: Z

Z

Meta