Class EventPublishingRunListener
- java.lang.Object
- org.springframework.boot.context.event.EventPublishingRunListener
- All Implemented Interfaces:
SpringApplicationRunListener
,org.springframework.core.Ordered
public class EventPublishingRunListener extends Object implements SpringApplicationRunListener, org.springframework.core.Ordered
SpringApplicationRunListener
to publishSpringApplicationEvent
s.Uses an internal
ApplicationEventMulticaster
for the events that are fired before the context is actually refreshed.
Constructor Summary
Constructors Constructor Description EventPublishingRunListener(SpringApplication application, String[] args)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 theApplicationContext
has been created and prepared, but before sources have been loaded.void
environmentPrepared(org.springframework.core.env.ConfigurableEnvironment environment)
Called once the environment has been prepared, but before theApplicationContext
has been created.void
failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception)
Called when a failure occurs when running the application.int
getOrder()
void
running(org.springframework.context.ConfigurableApplicationContext context)
Called immediately before the run method finishes, when the application context has been refreshed and allCommandLineRunners
andApplicationRunners
have been called.void
started(org.springframework.context.ConfigurableApplicationContext context)
The context has been refreshed and the application has started butCommandLineRunners
andApplicationRunners
have not been called.void
starting()
Called immediately when the run method has first started.
Constructor Detail
EventPublishingRunListener
public EventPublishingRunListener(SpringApplication application, String[] args)
Method Detail
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
starting
public void 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
environmentPrepared
public void environmentPrepared(org.springframework.core.env.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:
environment
- the environment
contextPrepared
public void contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
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
public void contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
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
public void started(org.springframework.context.ConfigurableApplicationContext context)
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.
running
public void running(org.springframework.context.ConfigurableApplicationContext context)
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:
running
in interfaceSpringApplicationRunListener
- Parameters:
context
- the application context.
failed
public void failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception)
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