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 publish SpringApplicationEvents.
Uses an internal ApplicationEventMulticaster for the events that are fired
before the context is actually refreshed.
- Since:
- 1.0.0
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextLoaded(org.springframework.context.ConfigurableApplicationContext context) Called once the application context has been loaded but before it has been refreshed.voidcontextPrepared(org.springframework.context.ConfigurableApplicationContext context) Called once theApplicationContexthas been created and prepared, but before sources have been loaded.voidenvironmentPrepared(ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment) Called once the environment has been prepared, but before theApplicationContexthas been created.voidCalled when a failure occurs when running the application.intgetOrder()voidCalled immediately before the run method finishes, when the application context has been refreshed and allCommandLineRunnersandApplicationRunnershave been called.voidThe context has been refreshed and the application has started butCommandLineRunnersandApplicationRunnershave not been called.voidstarting(ConfigurableBootstrapContext bootstrapContext) Called immediately when the run method has first started.
-
Constructor Details
-
EventPublishingRunListener
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
starting
Description copied from interface:SpringApplicationRunListenerCalled immediately when the run method has first started. Can be used for very early initialization.- Specified by:
startingin interfaceSpringApplicationRunListener- Parameters:
bootstrapContext- the bootstrap context
-
environmentPrepared
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment) Description copied from interface:SpringApplicationRunListenerCalled once the environment has been prepared, but before theApplicationContexthas been created.- Specified by:
environmentPreparedin interfaceSpringApplicationRunListener- Parameters:
bootstrapContext- the bootstrap contextenvironment- the environment
-
contextPrepared
public void contextPrepared(org.springframework.context.ConfigurableApplicationContext context) Description copied from interface:SpringApplicationRunListenerCalled once theApplicationContexthas been created and prepared, but before sources have been loaded.- Specified by:
contextPreparedin interfaceSpringApplicationRunListener- Parameters:
context- the application context
-
contextLoaded
public void contextLoaded(org.springframework.context.ConfigurableApplicationContext context) Description copied from interface:SpringApplicationRunListenerCalled once the application context has been loaded but before it has been refreshed.- Specified by:
contextLoadedin interfaceSpringApplicationRunListener- Parameters:
context- the application context
-
started
public void started(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken) Description copied from interface:SpringApplicationRunListenerThe context has been refreshed and the application has started butCommandLineRunnersandApplicationRunnershave not been called.- Specified by:
startedin interfaceSpringApplicationRunListener- Parameters:
context- the application context.timeTaken- the time taken to start the application ornullif unknown
-
ready
public void ready(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken) Description copied from interface:SpringApplicationRunListenerCalled immediately before the run method finishes, when the application context has been refreshed and allCommandLineRunnersandApplicationRunnershave been called.- Specified by:
readyin interfaceSpringApplicationRunListener- Parameters:
context- the application context.timeTaken- the time taken for the application to be ready ornullif unknown
-
failed
public void failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception) Description copied from interface:SpringApplicationRunListenerCalled when a failure occurs when running the application.- Specified by:
failedin interfaceSpringApplicationRunListener- Parameters:
context- the application context ornullif a failure occurred before the context was createdexception- the failure
-