call processConfigBeanDefinitions lazily if postProcessBeanDefinitionRegistry hasn't been called
This commit is contained in:
@@ -80,6 +80,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||||||
|
|
||||||
private boolean setMetadataReaderFactoryCalled = false;
|
private boolean setMetadataReaderFactoryCalled = false;
|
||||||
|
|
||||||
|
private boolean postProcessBeanDefinitionRegistryCalled = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link SourceExtractor} to use for generated bean definitions
|
* Set the {@link SourceExtractor} to use for generated bean definitions
|
||||||
@@ -126,6 +128,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||||||
* Derive further bean definitions from the configuration classes in the registry.
|
* Derive further bean definitions from the configuration classes in the registry.
|
||||||
*/
|
*/
|
||||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
|
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
|
||||||
|
this.postProcessBeanDefinitionRegistryCalled = true;
|
||||||
processConfigBeanDefinitions(registry);
|
processConfigBeanDefinitions(registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,9 +137,15 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||||||
* by replacing them with CGLIB-enhanced subclasses.
|
* by replacing them with CGLIB-enhanced subclasses.
|
||||||
*/
|
*/
|
||||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||||
|
if (!this.postProcessBeanDefinitionRegistryCalled) {
|
||||||
|
// BeanDefinitionRegistryPostProcessor hook apparently not supported...
|
||||||
|
// Simply call processConfigBeanDefinitions lazily at this point then.
|
||||||
|
processConfigBeanDefinitions((BeanDefinitionRegistry) beanFactory);
|
||||||
|
}
|
||||||
enhanceConfigurationClasses(beanFactory);
|
enhanceConfigurationClasses(beanFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build and validate a configuration model based on the registry of
|
* Build and validate a configuration model based on the registry of
|
||||||
* {@link Configuration} classes.
|
* {@link Configuration} classes.
|
||||||
|
|||||||
Reference in New Issue
Block a user