public class EventPublishingRunListener extends java.lang.Object implements SpringApplicationRunListener, org.springframework.core.Ordered
SpringApplicationRunListener to publish SpringApplicationEvents.
Uses an internal ApplicationEventMulticaster for the events that are fired
before the context is actually refreshed.
| Constructor and Description |
|---|
EventPublishingRunListener(SpringApplication application,
java.lang.String[] args) |
| Modifier and Type | Method and Description |
|---|---|
void |
contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
Called once the application context has been loaded but before it has been
refreshed.
|
void |
contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
Called once the
ApplicationContext has been created and prepared, but
before sources have been loaded. |
void |
environmentPrepared(ConfigurableBootstrapContext bootstrapContext,
org.springframework.core.env.ConfigurableEnvironment environment)
Called once the environment has been prepared, but before the
ApplicationContext has been created. |
void |
failed(org.springframework.context.ConfigurableApplicationContext context,
java.lang.Throwable exception)
Called when a failure occurs when running the application.
|
int |
getOrder() |
void |
ready(org.springframework.context.ConfigurableApplicationContext context,
java.time.Duration timeTaken)
Called immediately before the run method finishes, when the application context has
been refreshed and all
CommandLineRunners and
ApplicationRunners have been called. |
void |
started(org.springframework.context.ConfigurableApplicationContext context,
java.time.Duration timeTaken)
The context has been refreshed and the application has started but
CommandLineRunners and ApplicationRunners have not been called. |
void |
starting(ConfigurableBootstrapContext bootstrapContext)
Called immediately when the run method has first started.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrunning, startedpublic EventPublishingRunListener(SpringApplication application, java.lang.String[] args)
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void starting(ConfigurableBootstrapContext bootstrapContext)
SpringApplicationRunListenerstarting in interface SpringApplicationRunListenerbootstrapContext - the bootstrap contextpublic void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment)
SpringApplicationRunListenerApplicationContext has been created.environmentPrepared in interface SpringApplicationRunListenerbootstrapContext - the bootstrap contextenvironment - the environmentpublic void contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
SpringApplicationRunListenerApplicationContext has been created and prepared, but
before sources have been loaded.contextPrepared in interface SpringApplicationRunListenercontext - the application contextpublic void contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
SpringApplicationRunListenercontextLoaded in interface SpringApplicationRunListenercontext - the application contextpublic void started(org.springframework.context.ConfigurableApplicationContext context,
java.time.Duration timeTaken)
SpringApplicationRunListenerCommandLineRunners and ApplicationRunners have not been called.started in interface SpringApplicationRunListenercontext - the application context.timeTaken - the time taken to start the application or null if unknownpublic void ready(org.springframework.context.ConfigurableApplicationContext context,
java.time.Duration timeTaken)
SpringApplicationRunListenerCommandLineRunners and
ApplicationRunners have been called.ready in interface SpringApplicationRunListenercontext - the application context.timeTaken - the time taken for the application to be ready or null if
unknownpublic void failed(org.springframework.context.ConfigurableApplicationContext context,
java.lang.Throwable exception)
SpringApplicationRunListenerfailed in interface SpringApplicationRunListenercontext - the application context or null if a failure occurred before
the context was createdexception - the failure