Interface ImportBeanDefinitionRegistrar
- All Known Implementing Classes:
AutoProxyRegistrar
public interface ImportBeanDefinitionRegistrar
Interface to be implemented by types that register additional bean definitions when processing @Configurationclasses. Useful when operating at the bean definition level (as opposed to@Beanmethod/instance level) is desired or necessary.Along with
@ConfigurationandImportSelector, classes of this type may be provided to the @Importannotation (or may also be returned from anImportSelector).An
ImportBeanDefinitionRegistrarmay implement any of the followingAwareinterfaces, and their respective methods will be called prior toregisterBeanDefinitions(org.springframework.core.type.AnnotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.beans.factory.support.BeanNameGenerator):Alternatively, the class may provide a single constructor with one or more of the following supported parameter types:
See implementations and associated unit tests for usage examples.
- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
Import,ImportSelector,Configuration
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidregisterBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry)Register bean definitions as necessary based on the given annotation metadata of the importing@Configurationclass.default voidregisterBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator)Register bean definitions as necessary based on the given annotation metadata of the importing@Configurationclass.
Method Detail
registerBeanDefinitions
default void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator)
Register bean definitions as necessary based on the given annotation metadata of the importing@Configurationclass.Note that
BeanDefinitionRegistryPostProcessortypes may not be registered here, due to lifecycle constraints related to@Configurationclass processing.The default implementation delegates to
registerBeanDefinitions(AnnotationMetadata, BeanDefinitionRegistry).- Parameters:
importingClassMetadata- annotation metadata of the importing classregistry- current bean definition registryimportBeanNameGenerator- the bean name generator strategy for imported beans:ConfigurationClassPostProcessor.IMPORT_BEAN_NAME_GENERATORby default, or a user-provided one ifConfigurationClassPostProcessor.setBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator)has been set. In the latter case, the passed-in strategy will be the same used for component scanning in the containing application context (otherwise, the default component-scan naming strategy isAnnotationBeanNameGenerator.INSTANCE).- Since:
- 5.2
- See Also:
ConfigurationClassPostProcessor.IMPORT_BEAN_NAME_GENERATOR,ConfigurationClassPostProcessor.setBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator)
registerBeanDefinitions
default void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry)
Register bean definitions as necessary based on the given annotation metadata of the importing@Configurationclass.Note that
BeanDefinitionRegistryPostProcessortypes may not be registered here, due to lifecycle constraints related to@Configurationclass processing.The default implementation is empty.
- Parameters:
importingClassMetadata- annotation metadata of the importing classregistry- current bean definition registry