Class EventPublishingRunListener
java.lang.Object
org.springframework.boot.context.event.EventPublishingRunListener
- All Implemented Interfaces:
SpringApplicationRunListener
,Ordered
public class EventPublishingRunListener
extends Object
implements SpringApplicationRunListener, Ordered
SpringApplicationRunListener
to publish SpringApplicationEvent
s.
Uses an internal ApplicationEventMulticaster
for the events that are fired
before the context is actually refreshed.
- Since:
- 1.0.0
- Author:
- Phillip Webb, Stephane Nicoll, Andy Wilkinson, Artsiom Yudovin, Brian Clozel, Chris Bono
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called once the application context has been loaded but before it has been refreshed.void
Called once theApplicationContext
has been created and prepared, but before sources have been loaded.void
environmentPrepared
(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) Called once the environment has been prepared, but before theApplicationContext
has been created.void
failed
(ConfigurableApplicationContext context, Throwable exception) Called when a failure occurs when running the application.int
getOrder()
void
ready
(ConfigurableApplicationContext context, Duration timeTaken) Called immediately before the run method finishes, when the application context has been refreshed and allCommandLineRunners
andApplicationRunners
have been called.void
started
(ConfigurableApplicationContext context, Duration timeTaken) The context has been refreshed and the application has started butCommandLineRunners
andApplicationRunners
have not been called.void
starting
(ConfigurableBootstrapContext bootstrapContext) Called immediately when the run method has first started.
-
Constructor Details
-
EventPublishingRunListener
-
-
Method Details
-
getOrder
public int getOrder() -
starting
Description copied from interface:SpringApplicationRunListener
Called immediately when the run method has first started. Can be used for very early initialization.- Specified by:
starting
in interfaceSpringApplicationRunListener
- Parameters:
bootstrapContext
- the bootstrap context
-
environmentPrepared
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) Description copied from interface:SpringApplicationRunListener
Called once the environment has been prepared, but before theApplicationContext
has been created.- Specified by:
environmentPrepared
in interfaceSpringApplicationRunListener
- Parameters:
bootstrapContext
- the bootstrap contextenvironment
- the environment
-
contextPrepared
Description copied from interface:SpringApplicationRunListener
Called once theApplicationContext
has been created and prepared, but before sources have been loaded.- Specified by:
contextPrepared
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context
-
contextLoaded
Description copied from interface:SpringApplicationRunListener
Called once the application context has been loaded but before it has been refreshed.- Specified by:
contextLoaded
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context
-
started
Description copied from interface:SpringApplicationRunListener
The context has been refreshed and the application has started butCommandLineRunners
andApplicationRunners
have not been called.- Specified by:
started
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context.timeTaken
- the time taken to start the application ornull
if unknown
-
ready
Description copied from interface:SpringApplicationRunListener
Called immediately before the run method finishes, when the application context has been refreshed and allCommandLineRunners
andApplicationRunners
have been called.- Specified by:
ready
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context.timeTaken
- the time taken for the application to be ready ornull
if unknown
-
failed
Description copied from interface:SpringApplicationRunListener
Called when a failure occurs when running the application.- Specified by:
failed
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context ornull
if a failure occurred before the context was createdexception
- the failure
-