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
This commit is contained in:
parent
778e3eb091
commit
291388affe
|
@ -25,6 +25,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.event.ApplicationEventMulticaster;
|
import org.springframework.context.event.ApplicationEventMulticaster;
|
||||||
import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
||||||
import org.springframework.context.support.AbstractApplicationContext;
|
import org.springframework.context.support.AbstractApplicationContext;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +33,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
public class EventPublishingRunListener implements SpringApplicationRunListener {
|
public class EventPublishingRunListener implements SpringApplicationRunListener, Ordered {
|
||||||
|
|
||||||
private final ApplicationEventMulticaster multicaster;
|
private final ApplicationEventMulticaster multicaster;
|
||||||
|
|
||||||
|
@ -49,6 +50,11 @@ public class EventPublishingRunListener implements SpringApplicationRunListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void started() {
|
public void started() {
|
||||||
publishEvent(new ApplicationStartedEvent(this.application, this.args));
|
publishEvent(new ApplicationStartedEvent(this.application, this.args));
|
||||||
|
|
Loading…
Reference in New Issue