spring-framework / org.springframework.context.annotation / AnnotatedBeanDefinitionReader / registerBean

registerBean

open fun registerBean(annotatedClass: Class<*>): Unit

Register a bean from the given bean class, deriving its metadata from class-declared annotations.

Parameters

annotatedClass - the class of the bean

open fun <T : Any> registerBean(annotatedClass: Class<T>, @Nullable instanceSupplier: Supplier<T>): Unit

Register a bean from the given bean class, deriving its metadata from class-declared annotations, using the given supplier for obtaining a new instance (possibly declared as a lambda expression or method reference).

Parameters

annotatedClass - the class of the bean

instanceSupplier - a callback for creating an instance of the bean (may be null)

Since
5.0

open fun <T : Any> registerBean(annotatedClass: Class<T>, name: String, @Nullable instanceSupplier: Supplier<T>): Unit

Register a bean from the given bean class, deriving its metadata from class-declared annotations, using the given supplier for obtaining a new instance (possibly declared as a lambda expression or method reference).

Parameters

annotatedClass - the class of the bean

name - an explicit name for the bean

instanceSupplier - a callback for creating an instance of the bean (may be null)

Since
5.0

open fun registerBean(annotatedClass: Class<*>, vararg qualifiers: Class<out Annotation>): Unit

Register a bean from the given bean class, deriving its metadata from class-declared annotations.

Parameters

annotatedClass - the class of the bean

qualifiers - specific qualifier annotations to consider, in addition to qualifiers at the bean class level

open fun registerBean(annotatedClass: Class<*>, name: String, vararg qualifiers: Class<out Annotation>): Unit

Register a bean from the given bean class, deriving its metadata from class-declared annotations.

Parameters

annotatedClass - the class of the bean

name - an explicit name for the bean

qualifiers - specific qualifier annotations to consider, in addition to qualifiers at the bean class level