mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
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:
parent
faf02a21ab
commit
06c16ae452
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user