事件 | 触发时机 | 常用监听器描述 |
---|---|---|
ApplicationStartingEvent | 应用启动时 | LoggingApplicationListener:决定加载哪个日志系统 |
ApplicationEnvironmentPreparedEvent | 创建Environment之后 | BootstrapApplicationListener:加载spring-cloud bootstrap配置文件; LoggingSystemShutdownListener:清理日志系统资源; EnvironmentPostProcessorApplicationListener:调用EnvironmentPostProcessor实现类,如加载application-*.yml配置文件; LoggingApplicationListener:初始化日志系统; BackgroundPreinitializer:异步执行一些与初始化任务; DelegatingApplicationListener:读取配置文件中的context.listener.classes 自定义监听器类,实例化并在加入(自定义监听器的顺序是独立的) |
ApplicationContextInitializedEvent | 创建applicationContext并调用ApplicationContextInitializer之后 | |
ApplicationPreparedEvent | 加载xml bean文件之后 | LoggingApplicationListener:将日志系统注入容器 |
ContextRefreshedEvent | refreshContext流程结束之后 | RestartListener:重启后重新出发ApplicationEnvironmentPreparedEvent事件 |
ApplicationStartedEvent | 自定义afterRefresh方法调用之后 | |
ApplicationReadyEvent | spring-boot启动结束时 | |
ApplicationFailedEvent | spring-boot启动失败时 | |
ContextClosedEvent | ParentContextCloserApplicationListener:在context关闭时,同时关闭父contenxt |
spring-boot 事件
2024/10/24 21:36:29
来源:https://blog.csdn.net/TheThirdMoon/article/details/141825826
浏览:
次
关键词:spring-boot 事件
版权声明:
本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。
我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com