1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1498,11 +1498,14 @@ else if (mbd.isLazyInit()) {
1498
1498
*/
1499
1499
protected void markBeanAsCreated (String beanName ) {
1500
1500
if (!this .alreadyCreated .contains (beanName )) {
1501
- this .alreadyCreated .add (beanName );
1502
-
1503
- // Let the bean definition get re-merged now that we're actually creating
1504
- // the bean... just in case some of its metadata changed in the meantime.
1505
- clearMergedBeanDefinition (beanName );
1501
+ synchronized (this .mergedBeanDefinitions ) {
1502
+ if (!this .alreadyCreated .contains (beanName )) {
1503
+ // Let the bean definition get re-merged now that we're actually creating
1504
+ // the bean... just in case some of its metadata changed in the meantime.
1505
+ clearMergedBeanDefinition (beanName );
1506
+ this .alreadyCreated .add (beanName );
1507
+ }
1508
+ }
1506
1509
}
1507
1510
}
1508
1511
@@ -1511,7 +1514,9 @@ protected void markBeanAsCreated(String beanName) {
1511
1514
* @param beanName the name of the bean
1512
1515
*/
1513
1516
protected void cleanupAfterBeanCreationFailure (String beanName ) {
1514
- this .alreadyCreated .remove (beanName );
1517
+ synchronized (this .mergedBeanDefinitions ) {
1518
+ this .alreadyCreated .remove (beanName );
1519
+ }
1515
1520
}
1516
1521
1517
1522
/**
0 commit comments