Only check for singleton in AutoConfigurationReportLoggingInitializer

Using containsBean() involves looking in the parent bean factory
if there is one, and that would mean that the same report woykd be used
for multiple contexts, which wouldn't make sense.
This commit is contained in:
Dave Syer 2013-11-20 11:42:27 +00:00
parent faf02a21ab
commit 06c16ae452

View File

@ -59,7 +59,7 @@ public class AutoConfigurationReportLoggingInitializer implements
public void initialize(ConfigurableApplicationContext applicationContext) {
this.loggerBean = new AutoConfigurationReportLogger(applicationContext);
ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
if (!beanFactory.containsBean(LOGGER_BEAN)) {
if (!beanFactory.containsSingleton(LOGGER_BEAN)) {
beanFactory.registerSingleton(LOGGER_BEAN, this.loggerBean);
}
}