From 291388affea5e5e5c4540c3d52c1e51a177d1a18 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 24 Jun 2015 16:24:44 -0700 Subject: [PATCH] Make EventPublishingRunListener Ordered `0` Update EventPublishingRunListener to implement Ordered and use a default order of 0. This allows for other run listeners to be added either before or after it. Fixes gh-3305 --- .../boot/context/event/EventPublishingRunListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/event/EventPublishingRunListener.java b/spring-boot/src/main/java/org/springframework/boot/context/event/EventPublishingRunListener.java index 3dffba480c..f3399926d2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/event/EventPublishingRunListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/event/EventPublishingRunListener.java @@ -25,6 +25,7 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.event.ApplicationEventMulticaster; import org.springframework.context.event.SimpleApplicationEventMulticaster; import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.core.Ordered; import org.springframework.core.env.ConfigurableEnvironment; /** @@ -32,7 +33,7 @@ import org.springframework.core.env.ConfigurableEnvironment; * * @author Phillip Webb */ -public class EventPublishingRunListener implements SpringApplicationRunListener { +public class EventPublishingRunListener implements SpringApplicationRunListener, Ordered { private final ApplicationEventMulticaster multicaster; @@ -49,6 +50,11 @@ public class EventPublishingRunListener implements SpringApplicationRunListener } } + @Override + public int getOrder() { + return 0; + } + @Override public void started() { publishEvent(new ApplicationStartedEvent(this.application, this.args));