android-beans / rocks.frieler.android.beans.scopes.singleton / lazyInstantiatedBean

lazyInstantiatedBean

inline fun <reified T : Any> DeclarativeBeanConfiguration.lazyInstantiatedBean(name: String? = null, noinline definition: BeansProvider.() -> T): Unit

Adds a BeanDefinition for a SingletonScopedFactoryBean that produces a bean with the given definition, optionally with the specified name.

Since beans are singletons by default, this has the effect of a lazy instantiation.

Parameters

name - the bean's name (optional)

definition - the definition to construct the bean

Parameters