eagerSingleton

inline fun <T : Any> DI.Builder.eagerSingleton(noinline creator: NoArgBindingDI<Any>.() -> T): EagerSingleton<T>

Creates an eager singleton: will create an instance as soon as kodein is ready (all bindings are set) and will always return this instance.

T generics will be erased!

Return

An eager singleton ready to be bound.

Parameters

T

The created type.

creator

The function that will be called as soon as DI is ready. Guaranteed to be called only once. Should create a new instance.