Rename ApplicationStartedEvent
Rename `ApplicationStartedEvent` to `ApplicationStartingEvent` to avoid confusion. Fixes gh-7381
This commit is contained in:
committed by
Phillip Webb
parent
0e3a3df6f4
commit
e7db7adfb8
@@ -19,7 +19,7 @@ package org.springframework.boot.devtools.restart;
|
||||
import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -41,8 +41,8 @@ public class RestartApplicationListener
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (event instanceof ApplicationStartedEvent) {
|
||||
onApplicationStartedEvent((ApplicationStartedEvent) event);
|
||||
if (event instanceof ApplicationStartingEvent) {
|
||||
onApplicationStartingEvent((ApplicationStartingEvent) event);
|
||||
}
|
||||
if (event instanceof ApplicationPreparedEvent) {
|
||||
Restarter.getInstance()
|
||||
@@ -57,7 +57,7 @@ public class RestartApplicationListener
|
||||
}
|
||||
}
|
||||
|
||||
private void onApplicationStartedEvent(ApplicationStartedEvent event) {
|
||||
private void onApplicationStartingEvent(ApplicationStartingEvent event) {
|
||||
// It's too early to use the Spring environment but we should still allow
|
||||
// users to disable restart using a System property.
|
||||
String enabled = System.getProperty(ENABLED_PROPERTY);
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
@@ -92,7 +92,7 @@ public class RestartApplicationListenerTests {
|
||||
SpringApplication application = new SpringApplication();
|
||||
ConfigurableApplicationContext context = mock(
|
||||
ConfigurableApplicationContext.class);
|
||||
listener.onApplicationEvent(new ApplicationStartedEvent(application, ARGS));
|
||||
listener.onApplicationEvent(new ApplicationStartingEvent(application, ARGS));
|
||||
assertThat(Restarter.getInstance()).isNotEqualTo(nullValue());
|
||||
assertThat(Restarter.getInstance().isFinished()).isFalse();
|
||||
listener.onApplicationEvent(
|
||||
|
||||
Reference in New Issue
Block a user