|
|
|
|
@ -304,9 +304,6 @@ public class SpringApplication {
@@ -304,9 +304,6 @@ public class SpringApplication {
|
|
|
|
|
|
|
|
|
|
ApplicationEventMulticaster multicaster = createApplicationEventMulticaster(); |
|
|
|
|
try { |
|
|
|
|
Set<Object> sources = getSources(); |
|
|
|
|
registerListenerAndInitializerSources(multicaster, sources); |
|
|
|
|
|
|
|
|
|
// Allow logging and stuff to initialize very early
|
|
|
|
|
multicaster.multicastEvent(new ApplicationStartedEvent(this, args)); |
|
|
|
|
|
|
|
|
|
@ -319,17 +316,14 @@ public class SpringApplication {
@@ -319,17 +316,14 @@ public class SpringApplication {
|
|
|
|
|
multicaster.multicastEvent(new ApplicationEnvironmentPreparedEvent(this, |
|
|
|
|
args, environment)); |
|
|
|
|
|
|
|
|
|
// Sources might have changed when environment was applied
|
|
|
|
|
sources = getSources(); |
|
|
|
|
// Load the sources (might have changed when environment was applied)
|
|
|
|
|
Set<Object> sources = getSources(); |
|
|
|
|
Assert.notEmpty(sources, "Sources must not be empty"); |
|
|
|
|
|
|
|
|
|
if (this.showBanner) { |
|
|
|
|
printBanner(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Some sources might be listeners
|
|
|
|
|
registerListenerAndInitializerSources(multicaster, sources); |
|
|
|
|
|
|
|
|
|
// Create, load, refresh and run the ApplicationContext
|
|
|
|
|
context = createApplicationContext(); |
|
|
|
|
registerApplicationEventMulticaster(context, multicaster); |
|
|
|
|
@ -391,18 +385,6 @@ public class SpringApplication {
@@ -391,18 +385,6 @@ public class SpringApplication {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void registerListenerAndInitializerSources( |
|
|
|
|
ApplicationEventMulticaster multicaster, Set<Object> sources) { |
|
|
|
|
for (Object object : sources) { |
|
|
|
|
if (object instanceof ApplicationListener) { |
|
|
|
|
multicaster.addApplicationListener((ApplicationListener<?>) object); |
|
|
|
|
} |
|
|
|
|
if (object instanceof ApplicationContextInitializer) { |
|
|
|
|
addInitializers((ApplicationContextInitializer<?>) object); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void registerApplicationEventMulticaster( |
|
|
|
|
ConfigurableApplicationContext context, |
|
|
|
|
ApplicationEventMulticaster multicaster) { |
|
|
|
|
|