Commit 23991dd9 authored by Dave Syer's avatar Dave Syer

Participant -> Listener

parent 2aa56231
...@@ -261,8 +261,8 @@ public class SpringApplication { ...@@ -261,8 +261,8 @@ public class SpringApplication {
System.setProperty("java.awt.headless", Boolean.toString(this.headless)); System.setProperty("java.awt.headless", Boolean.toString(this.headless));
Collection<SpringApplicationRunParticipant> participants = createRunParticipants(args); Collection<SpringApplicationRunListener> participants = createRunParticipants(args);
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
participant.started(); participant.started();
} }
...@@ -271,7 +271,7 @@ public class SpringApplication { ...@@ -271,7 +271,7 @@ public class SpringApplication {
ConfigurableEnvironment environment = getOrCreateEnvironment(); ConfigurableEnvironment environment = getOrCreateEnvironment();
addPropertySources(environment, args); addPropertySources(environment, args);
setupProfiles(environment); setupProfiles(environment);
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
participant.environmentPrepared(environment); participant.environmentPrepared(environment);
} }
...@@ -287,7 +287,7 @@ public class SpringApplication { ...@@ -287,7 +287,7 @@ public class SpringApplication {
context.setEnvironment(environment); context.setEnvironment(environment);
postProcessApplicationContext(context); postProcessApplicationContext(context);
applyInitializers(context); applyInitializers(context);
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
participant.contextPrepared(context); participant.contextPrepared(context);
} }
if (this.logStartupInfo) { if (this.logStartupInfo) {
...@@ -298,14 +298,14 @@ public class SpringApplication { ...@@ -298,14 +298,14 @@ public class SpringApplication {
Set<Object> sources = getSources(); Set<Object> sources = getSources();
Assert.notEmpty(sources, "Sources must not be empty"); Assert.notEmpty(sources, "Sources must not be empty");
load(context, sources.toArray(new Object[sources.size()])); load(context, sources.toArray(new Object[sources.size()]));
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
participant.contextLoaded(context); participant.contextLoaded(context);
} }
// Refresh the context // Refresh the context
refresh(context); refresh(context);
afterRefresh(context, args); afterRefresh(context, args);
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
participant.finished(context, null); participant.finished(context, null);
} }
...@@ -317,7 +317,7 @@ public class SpringApplication { ...@@ -317,7 +317,7 @@ public class SpringApplication {
return context; return context;
} }
catch (Exception ex) { catch (Exception ex) {
for (SpringApplicationRunParticipant participant : participants) { for (SpringApplicationRunListener participant : participants) {
finishWithException(participant, context, ex); finishWithException(participant, context, ex);
} }
if (context != null) { if (context != null) {
...@@ -330,11 +330,11 @@ public class SpringApplication { ...@@ -330,11 +330,11 @@ public class SpringApplication {
} }
} }
private Collection<SpringApplicationRunParticipant> createRunParticipants( private Collection<SpringApplicationRunListener> createRunParticipants(
String[] args) { String[] args) {
List<SpringApplicationRunParticipant> participants = new ArrayList<SpringApplicationRunParticipant>(); List<SpringApplicationRunListener> participants = new ArrayList<SpringApplicationRunListener>();
participants.addAll(getSpringFactoriesInstances( participants.addAll(getSpringFactoriesInstances(
SpringApplicationRunParticipant.class, new Class<?>[] { SpringApplicationRunListener.class, new Class<?>[] {
SpringApplication.class, String[].class }, this, args)); SpringApplication.class, String[].class }, this, args));
return participants; return participants;
} }
...@@ -625,7 +625,7 @@ public class SpringApplication { ...@@ -625,7 +625,7 @@ public class SpringApplication {
runCommandLineRunners(context, args); runCommandLineRunners(context, args);
} }
private void finishWithException(SpringApplicationRunParticipant participant, private void finishWithException(SpringApplicationRunListener participant,
ConfigurableApplicationContext context, Exception exception) { ConfigurableApplicationContext context, Exception exception) {
try { try {
participant.finished(context, exception); participant.finished(context, exception);
......
...@@ -26,11 +26,12 @@ import org.springframework.core.io.support.SpringFactoriesLoader; ...@@ -26,11 +26,12 @@ import org.springframework.core.io.support.SpringFactoriesLoader;
* {@code run} method is called. Participants are loaded via the * {@code run} method is called. Participants are loaded via the
* {@link SpringFactoriesLoader} and should declare a public constructor that accepts a * {@link SpringFactoriesLoader} and should declare a public constructor that accepts a
* {@link SpringApplication} instance and a {@code String[]} of arguments. A new * {@link SpringApplication} instance and a {@code String[]} of arguments. A new
* {@link SpringApplicationRunParticipant} instance will be created for each run. * {@link SpringApplicationRunListener} instance will be created for each run.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Dave Syer
*/ */
public interface SpringApplicationRunParticipant { public interface SpringApplicationRunListener {
/** /**
* Called immediately when the run method has first started. Can be used for very * Called immediately when the run method has first started. Can be used for very
......
...@@ -18,7 +18,7 @@ package org.springframework.boot.context.event; ...@@ -18,7 +18,7 @@ package org.springframework.boot.context.event;
import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunParticipant; import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ApplicationEventMulticaster; import org.springframework.context.event.ApplicationEventMulticaster;
...@@ -27,11 +27,11 @@ import org.springframework.context.support.AbstractApplicationContext; ...@@ -27,11 +27,11 @@ import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
/** /**
* {@link SpringApplicationRunParticipant} to publish {@link SpringApplicationEvent}s. * {@link SpringApplicationRunListener} to publish {@link SpringApplicationEvent}s.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class EventPublishingRunParticipant implements SpringApplicationRunParticipant { public class EventPublishingRunListener implements SpringApplicationRunListener {
private final ApplicationEventMulticaster multicaster; private final ApplicationEventMulticaster multicaster;
...@@ -39,7 +39,7 @@ public class EventPublishingRunParticipant implements SpringApplicationRunPartic ...@@ -39,7 +39,7 @@ public class EventPublishingRunParticipant implements SpringApplicationRunPartic
private String[] args; private String[] args;
public EventPublishingRunParticipant(SpringApplication application, String[] args) { public EventPublishingRunListener(SpringApplication application, String[] args) {
this.application = application; this.application = application;
this.args = args; this.args = args;
this.multicaster = new SimpleApplicationEventMulticaster(); this.multicaster = new SimpleApplicationEventMulticaster();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment