31
31
* @author Phillip Webb
32
32
* @author Dave Syer
33
33
* @author Andy Wilkinson
34
+ * @author Artsiom Yudovin
34
35
*/
35
36
public interface SpringApplicationRunListener {
36
37
37
38
/**
38
39
* Called immediately when the run method has first started. Can be used for very
39
40
* early initialization.
40
41
*/
41
- void starting ();
42
+ default void starting () {
43
+ }
42
44
43
45
/**
44
46
* Called once the environment has been prepared, but before the
45
47
* {@link ApplicationContext} has been created.
46
48
* @param environment the environment
47
49
*/
48
- void environmentPrepared (ConfigurableEnvironment environment );
50
+ default void environmentPrepared (ConfigurableEnvironment environment ) {
51
+ }
49
52
50
53
/**
51
54
* Called once the {@link ApplicationContext} has been created and prepared, but
52
55
* before sources have been loaded.
53
56
* @param context the application context
54
57
*/
55
- void contextPrepared (ConfigurableApplicationContext context );
58
+ default void contextPrepared (ConfigurableApplicationContext context ) {
59
+ }
56
60
57
61
/**
58
62
* Called once the application context has been loaded but before it has been
59
63
* refreshed.
60
64
* @param context the application context
61
65
*/
62
- void contextLoaded (ConfigurableApplicationContext context );
66
+ default void contextLoaded (ConfigurableApplicationContext context ) {
67
+ }
63
68
64
69
/**
65
70
* The context has been refreshed and the application has started but
@@ -68,7 +73,8 @@ public interface SpringApplicationRunListener {
68
73
* @param context the application context.
69
74
* @since 2.0.0
70
75
*/
71
- void started (ConfigurableApplicationContext context );
76
+ default void started (ConfigurableApplicationContext context ) {
77
+ }
72
78
73
79
/**
74
80
* Called immediately before the run method finishes, when the application context has
@@ -77,7 +83,8 @@ public interface SpringApplicationRunListener {
77
83
* @param context the application context.
78
84
* @since 2.0.0
79
85
*/
80
- void running (ConfigurableApplicationContext context );
86
+ default void running (ConfigurableApplicationContext context ) {
87
+ }
81
88
82
89
/**
83
90
* Called when a failure occurs when running the application.
@@ -86,6 +93,7 @@ public interface SpringApplicationRunListener {
86
93
* @param exception the failure
87
94
* @since 2.0.0
88
95
*/
89
- void failed (ConfigurableApplicationContext context , Throwable exception );
96
+ default void failed (ConfigurableApplicationContext context , Throwable exception ) {
97
+ }
90
98
91
99
}
0 commit comments