Package org.springframework.boot
Interface SpringApplicationRunListener
- All Known Implementing Classes:
EventPublishingRunListener
public interface SpringApplicationRunListener
Listener for theSpringApplication
run
method.SpringApplicationRunListener
s are loaded via theSpringFactoriesLoader
and should declare a public constructor that accepts aSpringApplication
instance and aString[]
of arguments. A newSpringApplicationRunListener
instance will be created for each run.
Method Summary
All Methods Instance Methods Abstract 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.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.
Method Detail
starting
void starting()
Called immediately when the run method has first started. Can be used for very early initialization.
environmentPrepared
void environmentPrepared(org.springframework.core.env.ConfigurableEnvironment environment)
Called once the environment has been prepared, but before theApplicationContext
has been created.- Parameters:
environment
- the environment
contextPrepared
void contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
Called once theApplicationContext
has been created and prepared, but before sources have been loaded.- Parameters:
context
- the application context
contextLoaded
void contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
Called once the application context has been loaded but before it has been refreshed.- Parameters:
context
- the application context
started
void started(org.springframework.context.ConfigurableApplicationContext context)
The context has been refreshed and the application has started butCommandLineRunners
andApplicationRunners
have not been called.- Parameters:
context
- the application context.- Since:
- 2.0.0
running
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.- Parameters:
context
- the application context.- Since:
- 2.0.0
failed
void failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception)
Called when a failure occurs when running the application.- Parameters:
context
- the application context ornull
if a failure occurred before the context was createdexception
- the failure- Since:
- 2.0.0