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

猜你喜欢

转载自www.cnblogs.com/mcalm/p/9701124.html