spring-framework / org.springframework.context.support / BeanDefinitionDsl

BeanDefinitionDsl

open class BeanDefinitionDsl : ApplicationContextInitializer<GenericApplicationContext>

Class implementing functional bean definition Kotlin DSL.

Types

Autowire

enum class Autowire

Autowire enum constants.

BeanDefinitionContext

inner class BeanDefinitionContext

Provide read access to some application context facilities.

Scope

enum class Scope

Scope enum constants.

Constructors

<init>

BeanDefinitionDsl(condition: (ConfigurableEnvironment) -> Boolean = { true })

Create a new bean definition DSL.

Functions

bean

fun <T : Any> bean(name: String? = null, scope: Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, autowireMode: Autowire = Autowire.CONSTRUCTOR, isAutowireCandidate: Boolean? = null): Unit

Declare a bean definition from the given bean class which can be inferred when possible.

fun <T : Any> bean(name: String? = null, scope: Scope? = null, isLazyInit: Boolean? = null, isPrimary: Boolean? = null, autowireMode: Autowire = Autowire.NO, isAutowireCandidate: Boolean? = null, function: BeanDefinitionContext.() -> T): Unit

Declare a bean definition using the given supplier for obtaining a new instance.

environment

fun environment(condition: ConfigurableEnvironment.() -> Boolean, init: BeanDefinitionDsl.() -> Unit): BeanDefinitionDsl

Take in account bean definitions enclosed in the provided lambda only when the specified environment-based predicate is true.

initialize

open fun initialize(context: GenericApplicationContext): Unit

Register the bean defined via the DSL on the provided application context.

profile

fun profile(profile: String, init: BeanDefinitionDsl.() -> Unit): BeanDefinitionDsl

Take in account bean definitions enclosed in the provided lambda only when the specified profile is active.