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

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM