winter / io.jentz.winter / Component / Builder / eagerSingleton

eagerSingleton

inline fun <reified R : Any> eagerSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, noinline onPostConstruct: GFactoryCallback<R>? = null, noinline onClose: GFactoryCallback<R>? = null, noinline factory: GFactory<R>): TypeKey<R>

Register an eager singleton scoped factory for an instance of type R.

This behaves exactly like singleton but the instance will be created as soon as the dependency graph is initialize.

Parameters

qualifier - An optional qualifier.

generics - If true this will preserve generic information of R.

override - If true this will override a existing provider of this type.

onPostConstruct - A post construct callback.

onClose - A callback that gets called when the dependency graph gets closed.

factory - The factory for R.