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

bean

inline fun <reified 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.

Parameters

name - the name of the bean

scope - Override the target scope of this bean, specifying a new scope name.

isLazyInit - Set whether this bean should be lazily initialized.

isPrimary - Set whether this bean is a primary autowire candidate.

autowireMode - Set the autowire mode, Autowire.CONSTRUCTOR by default

isAutowireCandidate - Set whether this bean is a candidate for getting autowired into some other bean.

See Also

GenericApplicationContext.registerBean

org.springframework.beans.factory.config.BeanDefinition

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

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

Parameters

name - the name of the bean

scope - Override the target scope of this bean, specifying a new scope name.

isLazyInit - Set whether this bean should be lazily initialized.

isPrimary - Set whether this bean is a primary autowire candidate.

autowireMode - Set the autowire mode, Autowire.NO by default

isAutowireCandidate - Set whether this bean is a candidate for getting autowired into some other bean.

function - the bean supplier function

See Also

GenericApplicationContext.registerBean

org.springframework.beans.factory.config.BeanDefinition