Skip to content

Commit

Permalink
AbstractBeanFactory consistently guards add/remove operations against…
Browse files Browse the repository at this point in the history
… alreadyCreated Set

Issue: SPR-14269
  • Loading branch information
jhoeller committed May 31, 2016
1 parent 9064d38 commit 71463fb
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1504,10 +1504,11 @@ else if (mbd.isLazyInit()) {
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);
}
}
}
Expand All @@ -1518,7 +1519,9 @@ protected void markBeanAsCreated(String beanName) {
* @param beanName the name of the bean
*/
protected void cleanupAfterBeanCreationFailure(String beanName) {
this.alreadyCreated.remove(beanName);
synchronized (this.mergedBeanDefinitions) {
this.alreadyCreated.remove(beanName);
}
}

/**
Expand Down

0 comments on commit 71463fb

Please sign in to comment.