/*
 * Copyright 2012-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.io.support.SpringFactoriesLoader;

/**
 * Listener for the {@link SpringApplication} {@code run} method.
 * {@link SpringApplicationRunListener}s are loaded via the {@link SpringFactoriesLoader}
 * and should declare a public constructor that accepts a {@link SpringApplication}
 * instance and a {@code String[]} of arguments. A new
 * {@link SpringApplicationRunListener} instance will be created for each run.
 *
 * @author Phillip Webb
 * @author Dave Syer
 * @author Andy Wilkinson
 */
public interface SpringApplicationRunListener {

	/**
	 * Called immediately when the run method has first started. Can be used for very
	 * early initialization.
	 */
	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);

	/**
	 * 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);

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

	/**
	 * The context has been refreshed and the application has started but
	 * {@link CommandLineRunner CommandLineRunners} and {@link ApplicationRunner
	 * ApplicationRunners} have not been called.
	 * @param context the application context.
	 * @since 2.0.0
	 */
	void started(ConfigurableApplicationContext context);

	/**
	 * Called immediately before the run method finishes, when the application context has
	 * been refreshed and all {@link CommandLineRunner CommandLineRunners} and
	 * {@link ApplicationRunner ApplicationRunners} have been called.
	 * @param context the application context.
	 * @since 2.0.0
	 */
	void running(ConfigurableApplicationContext context);

	/**
	 * Called when a failure occurs when running the application.
	 * @param context the application context or {@code null} if a failure occurred before
	 * the context was created
	 * @param exception the failure
	 * @since 2.0.0
	 */
	void failed(ConfigurableApplicationContext context, Throwable exception);

}

@@ -1352,20 +1352,47 @@
 lkinson%0A
+ * @author Artsiom Yudovin%0A
  */%0A
-
 public i
@@ -1548,24 +1548,32 @@
 tion.%0A%09 */%0A%09
+default 
 void startin
@@ -1575,17 +1575,21 @@
 arting()
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09
@@ -1743,24 +1743,32 @@
 nment%0A%09 */%0A%09
+default 
 void environ
@@ -1816,17 +1816,21 @@
 ronment)
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09
@@ -1988,32 +1988,40 @@
 n context%0A%09 */%0A%09
+default 
 void contextPrep
@@ -2056,33 +2056,37 @@
 Context context)
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09 * Calle
@@ -2215,24 +2215,32 @@
 ntext%0A%09 */%0A%09
+default 
 void context
@@ -2277,33 +2277,37 @@
 Context context)
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09 * The c
@@ -2555,24 +2555,32 @@
 2.0.0%0A%09 */%0A%09
+default 
 void started
@@ -2611,33 +2611,37 @@
 Context context)
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09 * Calle
@@ -2925,24 +2925,32 @@
 2.0.0%0A%09 */%0A%09
+default 
 void running
@@ -2989,17 +2989,21 @@
 context)
-;
+ %7B%0A%09%7D
 %0A%0A%09/**%0A%09
@@ -3236,16 +3236,24 @@
 0%0A%09 */%0A%09
+default 
 void fai
@@ -3316,13 +3316,17 @@
 ception)
-;
+ %7B%0A%09%7D
 %0A%0A%7D%0A

Add default no-op method to SpringApplicationRunListener