Skip to content

Commit

Permalink
Add default no-op method to SpringApplicationRunListener
Browse files Browse the repository at this point in the history
  • Loading branch information
ayudovin authored and snicoll committed Mar 16, 2019
1 parent 3d0219c commit 997f07d
Showing 1 changed file with 15 additions and 7 deletions.
Expand Up @@ -31,35 +31,40 @@
* @author Phillip Webb
* @author Dave Syer
* @author Andy Wilkinson
* @author Artsiom Yudovin
*/
public interface SpringApplicationRunListener {

/**
* Called immediately when the run method has first started. Can be used for very
* early initialization.
*/
void starting();
default void starting() {
}

/**
* Called once the environment has been prepared, but before the
* {@link ApplicationContext} has been created.
* @param environment the environment
*/
void environmentPrepared(ConfigurableEnvironment environment);
default void environmentPrepared(ConfigurableEnvironment environment) {
}

/**
* Called once the {@link ApplicationContext} has been created and prepared, but
* before sources have been loaded.
* @param context the application context
*/
void contextPrepared(ConfigurableApplicationContext context);
default void contextPrepared(ConfigurableApplicationContext context) {
}

/**
* Called once the application context has been loaded but before it has been
* refreshed.
* @param context the application context
*/
void contextLoaded(ConfigurableApplicationContext context);
default void contextLoaded(ConfigurableApplicationContext context) {
}

/**
* The context has been refreshed and the application has started but
Expand All @@ -68,7 +73,8 @@ public interface SpringApplicationRunListener {
* @param context the application context.
* @since 2.0.0
*/
void started(ConfigurableApplicationContext context);
default void started(ConfigurableApplicationContext context) {
}

/**
* Called immediately before the run method finishes, when the application context has
Expand All @@ -77,7 +83,8 @@ public interface SpringApplicationRunListener {
* @param context the application context.
* @since 2.0.0
*/
void running(ConfigurableApplicationContext context);
default void running(ConfigurableApplicationContext context) {
}

/**
* Called when a failure occurs when running the application.
Expand All @@ -86,6 +93,7 @@ public interface SpringApplicationRunListener {
* @param exception the failure
* @since 2.0.0
*/
void failed(ConfigurableApplicationContext context, Throwable exception);
default void failed(ConfigurableApplicationContext context, Throwable exception) {
}

}

0 comments on commit 997f07d

Please sign in to comment.