Spring4.0 and above about
PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors()
A question of :
in this method, we can see that it calls the following method several times:
postProcessorNames = beanFactory.getBeanNamesForType(BeanDefinitionRegistryPostProcessor.class, true, false)
even called the method in the loop:
while (reiterate) {
reiterate = false;
postProcessorNames = beanFactory.getBeanNamesForType(BeanDefinitionRegistryPostProcessor.class, true, false);
for (String ppName : postProcessorNames) {
if (!processedBeans.contains(ppName)) {
currentRegistryProcessors.add(beanFactory.getBean(ppName, BeanDefinitionRegistryPostProcessor.class));
processedBeans.add(ppName);
reiterate = true;
}
}
sortPostProcessors(currentRegistryProcessors, beanFactory);
registryProcessors.addAll(currentRegistryProcessors);
invokeBeanDefinitionRegistryPostProcessors(currentRegistryProcessors, registry);
currentRegistryProcessors.clear();
}
my guess is that it is possible to call
postProcessor.postProcessBeanDefinitionRegistry(registry);
The method will lead to changes in the relevant bean definition in beanFactory, so it has been called many times. I don"t know how you understand it. Thank you.