abstract class DeclarativeBeanConfiguration : BeanConfiguration
Abstract super-class for BeanConfigurations to define their beans in a declarative fashion.
Usage example:
// 1. extend BeanConfiguration:
class MyBeanConfiguration : DeclarativeBeanConfiguration() {
override fun beans() {
// 2. define your beans:
bean("my_bean") {
// 3. obtain dependency to another bean:
val anotherBean = lookUpBean(AnotherBean::class)
MyBean(anotherBean!!)
}
}
}
Author
Christopher Frieler
DeclarativeBeanConfiguration()
Abstract super-class for BeanConfigurations to define their beans in a declarative fashion. |
fun <T : Any> bean(beanDefinition: BeanDefinition<T>): Unit
Defines a bean through a BeanDefinition. fun <T : Any> bean(name: String? = null, definition: BeansProvider.() -> T): Unit
Defines a bean, optionally with the specified name. fun <T : Any> bean(name: String? = null, type: Class<T>, definition: BeansProvider.() -> T): Unitfun <T : Any> bean(name: String? = null, type: Class<T>, definition: () -> T): Unit
Defines a bean (optionally with the specified name) of a Java type. |
|
abstract fun beans(): Unit |
|
fun getBeanDefinitions(): List<BeanDefinition<*>>
Returns BeanDefinitions for the beans defined by this BeanConfiguration. |
fun <T : Any> addBeanDefinition(beanDefinition: BeanDefinition<T>): Unit
Adds a BeanDefinition to this BeanConfiguration. |
fun <T : Any> DeclarativeBeanConfiguration.activityScopedBean(name: String? = null, definition: BeansProvider.() -> T): Unit
Adds a BeanDefinition for an ActivityScopedFactoryBean that produces a bean with the given definition, optionally with the specified name. |
|
fun <T : Any> DeclarativeBeanConfiguration.lazyInstantiatedBean(name: String? = null, definition: BeansProvider.() -> T): Unit
Adds a BeanDefinition for a SingletonScopedFactoryBean that produces a bean with the given definition, optionally with the specified name. |
|
fun <T : Any> DeclarativeBeanConfiguration.prototypeBean(name: String? = null, definition: BeansProvider.() -> T): Unit
Adds a BeanDefinition for a PrototypeScopedFactoryBean that produces a bean with the given definition, optionally with the specified name. |