withOptions

infix inline fun <T> KoinDefinition<T>.withOptions(options: DefinitionOptions<T>): KoinDefinition<T>

Apply additional options to a definition using a DSL block.

This allows you to configure qualifiers, bindings, lifecycle callbacks, and other definition properties in a structured way.

Return

this definition for chaining

Author

Arnaud Giuliani

Example:

single { MyService() } withOptions {
named("production")
bind<ServiceInterface>()
createdAtStart()
override()
}

Parameters

options

Lambda with receiver on BeanDefinition to configure options