named

Assign a string-based qualifier to this definition. Used within withOptions { } block.

Parameters

name

The string name to use as qualifier

Example:

single { MyService() } withOptions {
named("production")
}
// Retrieve with: get(qualifier = named("production"))

inline fun <T> BeanDefinition<*>.named()

Assign a type-based qualifier to this definition. Used within withOptions { } block.

The qualifier will be based on the reified type T.

Example:

single { MyService() } withOptions {
named<ProductionQualifier>()
}
// Retrieve with: get(qualifier = named<ProductionQualifier>())