Interface BeanRegistry
- All Known Implementing Classes:
BeanRegistryAdapter
public interface BeanRegistry
Used in
BeanRegistrar.register(BeanRegistry, Environment) to expose
programmatic bean registration capabilities.- Since:
- 7.0
- Author:
- Sebastien Deleuze
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSpecification for customizing a bean.static interfaceContext available from the bean instance supplier designed to give access to bean dependencies. -
Method Summary
Modifier and TypeMethodDescriptionvoidregister(BeanRegistrar registrar) Register beans using the givenBeanRegistrar.<T> StringregisterBean(Class<T> beanClass) Register a bean from the given bean class, which will be instantiated using the relatedresolvable constructorif any.<T> StringregisterBean(Class<T> beanClass, Consumer<BeanRegistry.Spec<T>> customizer) Register a bean from the given bean class, customizing it with the customizer callback.<T> voidregisterBean(String name, Class<T> beanClass) Register a bean from the given bean class, which will be instantiated using the relatedresolvable constructorif any.<T> voidregisterBean(String name, Class<T> beanClass, Consumer<BeanRegistry.Spec<T>> customizer) Register a bean from the given bean class, customizing it with the customizer callback.
-
Method Details
-
registerBean
Register a bean from the given bean class, which will be instantiated using the relatedresolvable constructorif any.- Parameters:
beanClass- the class of the bean- Returns:
- the generated bean name
-
registerBean
Register a bean from the given bean class, customizing it with the customizer callback. The bean will be instantiated using the supplier that can be configured in the customizer callback, or will be tentatively instantiated with itsresolvable constructorotherwise.- Parameters:
beanClass- the class of the beancustomizer- callback to customize other bean properties than the name- Returns:
- the generated bean name
-
registerBean
Register a bean from the given bean class, which will be instantiated using the relatedresolvable constructorif any.- Parameters:
name- the name of the beanbeanClass- the class of the bean
-
registerBean
Register a bean from the given bean class, customizing it with the customizer callback. The bean will be instantiated using the supplier that can be configured in the customizer callback, or will be tentatively instantiated with itsresolvable constructorotherwise.- Parameters:
name- the name of the beanbeanClass- the class of the beancustomizer- callback to customize other bean properties than the name
-
register
Register beans using the givenBeanRegistrar.- Parameters:
registrar- the bean registrar that will be called to register additional beans
-