added assertions for correct postProcess invocation order
This commit is contained in:
parent
5f9b2db90b
commit
8446fd1b26
|
|
@ -82,6 +82,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||||
|
|
||||||
private boolean postProcessBeanDefinitionRegistryCalled = false;
|
private boolean postProcessBeanDefinitionRegistryCalled = false;
|
||||||
|
|
||||||
|
private boolean postProcessBeanFactoryCalled = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link SourceExtractor} to use for generated bean definitions
|
* Set the {@link SourceExtractor} to use for generated bean definitions
|
||||||
|
|
@ -128,6 +130,14 @@ 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) {
|
||||||
|
if (this.postProcessBeanDefinitionRegistryCalled) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"postProcessBeanDefinitionRegistry already called for this post-processor");
|
||||||
|
}
|
||||||
|
if (this.postProcessBeanFactoryCalled) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"postProcessBeanFactory already called for this post-processor");
|
||||||
|
}
|
||||||
this.postProcessBeanDefinitionRegistryCalled = true;
|
this.postProcessBeanDefinitionRegistryCalled = true;
|
||||||
processConfigBeanDefinitions(registry);
|
processConfigBeanDefinitions(registry);
|
||||||
}
|
}
|
||||||
|
|
@ -137,6 +147,11 @@ 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.postProcessBeanFactoryCalled) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"postProcessBeanFactory already called for this post-processor");
|
||||||
|
}
|
||||||
|
this.postProcessBeanFactoryCalled = true;
|
||||||
if (!this.postProcessBeanDefinitionRegistryCalled) {
|
if (!this.postProcessBeanDefinitionRegistryCalled) {
|
||||||
// BeanDefinitionRegistryPostProcessor hook apparently not supported...
|
// BeanDefinitionRegistryPostProcessor hook apparently not supported...
|
||||||
// Simply call processConfigBeanDefinitions lazily at this point then.
|
// Simply call processConfigBeanDefinitions lazily at this point then.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue