AbstractBeanFactory consistently guards add/remove operations against alreadyCreated Set
Issue: SPR-14269
This commit is contained in:
@@ -1504,10 +1504,11 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
protected void markBeanAsCreated(String beanName) {
|
||||
if (!this.alreadyCreated.contains(beanName)) {
|
||||
synchronized (this.mergedBeanDefinitions) {
|
||||
if (this.alreadyCreated.add(beanName)) {
|
||||
if (!this.alreadyCreated.contains(beanName)) {
|
||||
// Let the bean definition get re-merged now that we're actually creating
|
||||
// the bean... just in case some of its metadata changed in the meantime.
|
||||
clearMergedBeanDefinition(beanName);
|
||||
this.alreadyCreated.add(beanName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1518,7 +1519,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
* @param beanName the name of the bean
|
||||
*/
|
||||
protected void cleanupAfterBeanCreationFailure(String beanName) {
|
||||
this.alreadyCreated.remove(beanName);
|
||||
synchronized (this.mergedBeanDefinitions) {
|
||||
this.alreadyCreated.remove(beanName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user