spring boot监听器顺序

spring boot中支持的事件类型定在org.springframework.boot.context.event包中,目前支持的事件类型有如下6种:

执行顺序:  

1、ApplicationStartingEvent             spring boot最开始启动时触发。

2、ApplicationEnvironmentPreparedEvent     spring boot环境已经准备好,但上下文还没有创建时触发。       

3、ApplicationPreparedEvent             spring boot上下文context创建完成,但此时spring中的bean是没有完全加载完成的。

4、ApplicationStartedEvent           spring boot开始启动时触发,可以在SpringApplication启动之前做一些手脚。

5、ApplicationReadyEvent            spring boot上下文已经准备完毕的时候触发。

err、ApplicationFailedEvent             spring boot启动失败触发。

 

Spring boot学习,推荐:https://gitee.com/didispace/SpringBoot-Learning

 

 

posted on 2018-09-25 18:19  M_calm  阅读(2181)  评论(0)    收藏  举报

导航