public interface ImportBeanDefinitionRegistrar
Configuration
classes. Useful when operating at the bean definition
level (as opposed to @Bean
method/instance level) is desired or necessary.
Along with @Configuration
and ImportSelector
, classes of this type
may be provided to the @Import
annotation (or may also be returned from an
ImportSelector
).
An ImportBeanDefinitionRegistrar
may implement any of the following
Aware
interfaces, and their respective
methods will be called prior to registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry)
:
See implementations and associated unit tests for usage examples.
Import
,
ImportSelector
,
Configuration
Modifier and Type | Method and Description |
---|---|
void |
registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
BeanDefinitionRegistry registry)
Register bean definitions as necessary based on the given annotation metadata of
the importing
@Configuration class. |
void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry)
@Configuration
class.
Note that BeanDefinitionRegistryPostProcessor
types may not be
registered here, due to lifecycle constraints related to @Configuration
class processing.
importingClassMetadata
- annotation metadata of the importing classregistry
- current bean definition registry