Function autowire

Autowire a constructor, field or a method.

auto auto autowire(Z, T) (
  Z factory
)
if (getMembersWithProtection!(T, "__ctor", "public").length > 0);

auto auto autowire(string member, Z, T) (
  Z factory
)
if (getMembersWithProtection!(T, member, "public").length > 0);

auto auto autowire(string member, Z, T) (
  Z factory
)
if (isField!(T, member));

Autowire a constructor, field or a method. A constructor is autowired only when no member is passed as argument. When a member is passed as argument, it will be called with a list of references (where args are identified by their type FQN) in case when member is a function, or it will set the member to the value that is located in container by it's type FQN.

Note

In case of constructors as well as methods that are overloaded, the first constructor or method from overload set is selected to be autowired.

Parameters

NameDescription
T the component type
member field or method of component T
factory ConfigurationContextFactory where to inject the constructor or method configurer

Returns

Z