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()) }
}
val graph = derived.createGraph { constant<Application>(myApplicationInstance) }

See also

Types

Link copied to clipboard
class Builder
Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The components qualifier.

Functions

Link copied to clipboard
fun createGraph(application: WinterApplication = Winter, block: ComponentBuilderBlock? = null): Graph

Create a object graph from this component.

Link copied to clipboard
fun derive(qualifier: Qualifier = this.qualifier, block: ComponentBuilderBlock): Component

Create an extended copy of this component.

Link copied to clipboard

Returns a subcomponent by its qualifier.

Link copied to clipboard

Returns a subcomponent by its path.