接口 SpringApplicationRunListener
- 所有已知实现类:
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.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.
方法详细资料
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.- 参数:
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.- 参数:
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.- 参数:
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.- 参数:
context
- the application context.- 从以下版本开始:
- 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.- 参数:
context
- the application context.- 从以下版本开始:
- 2.0.0