class Component
The Component stores the dependency providers which are than retrieved and instantiated by an instance of a graph.
Instances are build by calling component with a builder block.
Components are immutable but an extended variant can be created by calling derive with a builder block.
val appComponent = component {
singleton<MyService> { MyServiceImpl(instance()) }
}
val derived = appComponent.derive {
prototype<MyOtherService> { MyOtherServiceImpl(instance(), instance("named")) }
}
val graph = derived.createGraph { constant<Application>(myApplicationInstance) }
See Also
class Builder |
val qualifier: Any
The components qualifier. |
fun createGraph(application: WinterApplication = Winter, block: ComponentBuilderBlock? = null): Graph
Create a object graph from this component. |
|
fun derive(qualifier: Any = this.qualifier, block: ComponentBuilderBlock): Component
Create an extended copy of this component. |
|
fun subcomponent(vararg qualifiers: Any): Component
Returns a subcomponent by its qualifier or a nested subcomponent by its path of qualifiers. |
val EMPTY: Component |