-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Stefan Schmidt opened SPR-5996 and commented
Currently a BeanCreationException is thrown if the log level is not set to DEBUG (as per code snippet below). However, the exception should never be thrown if beanFactory.isCurrentlyInCreation is true. It should log the message when in DEBUG mode, otherwise do nothing.
This issue was caused by a change made to address #10422 in Spring Framework 3.0.0.M4 committed in revision 1327.
Current code in BeanConfigurerSupport (line 152 - 162):
if (rootCause instanceof BeanCurrentlyInCreationException) {
BeanCreationException bce = (BeanCreationException) rootCause;
if (logger.isDebugEnabled() && this.beanFactory.isCurrentlyInCreation(bce.getBeanName())) {
logger.debug("Failed to create target bean '" + bce.getBeanName() +
"' while configuring object of type [" + beanInstance.getClass().getName() +
"] - probably due to a circular reference. This is a common startup situation " +
"and usually not fatal. Proceeding without injection. Original exception: " + ex);
return;
}
}
throw ex;
This should be changed to:
if (rootCause instanceof BeanCurrentlyInCreationException) {
BeanCreationException bce = (BeanCreationException) rootCause;
if (this.beanFactory.isCurrentlyInCreation(bce.getBeanName())) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to create target bean '" + bce.getBeanName() +
"' while configuring object of type [" + beanInstance.getClass().getName() +
"] - probably due to a circular reference. This is a common startup situation " +
"and usually not fatal. Proceeding without injection. Original exception: " + ex);
}
return;
}
}
throw ex;
No further details from SPR-5996