Skip to content

Commit 06c16ae

Browse files
author
Dave Syer
committed
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.
1 parent faf02a2 commit 06c16ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationReportLoggingInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class AutoConfigurationReportLoggingInitializer implements
5959
public void initialize(ConfigurableApplicationContext applicationContext) {
6060
this.loggerBean = new AutoConfigurationReportLogger(applicationContext);
6161
ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
62-
if (!beanFactory.containsBean(LOGGER_BEAN)) {
62+
if (!beanFactory.containsSingleton(LOGGER_BEAN)) {
6363
beanFactory.registerSingleton(LOGGER_BEAN, this.loggerBean);
6464
}
6565
}

0 commit comments

Comments
 (0)