美文网首页
Spring boot启动之事件发布

Spring boot启动之事件发布

作者: engineer_tang | 来源:发表于2022-08-01 16:53 被阅读0次

Spring boot启动过程要发布一系列事件,来完成Spring boot各阶段任务的有序进行。其中包括ApplicationStartingEvent、ApplicationEnvironmentPreparedEvent、ApplicationContextInitializedEvent、ApplicationPreparedEvent、ApplicationStartedEvent 、ApplicationReadyEvent。

1. ApplicationStartingEvent

LoggingApplicationListener
BackgroundPreInitializer
DelegatingApplicationListener
LiquibaseServiceLocatorApplicationListener

2. ApplicationEnvironmentPreparedEvent

EnvironmentPostProcesserApplicationListener
AnsiOutputApplicationListener
LoggingApplicationListener
BackgroundPreInitializer
DelegatingApplicationListener
FileEncodingApplicationListener

3. ApplicationContextInitializedEvent

BackgroundPreInitializer
DelegatingApplicationListener

3.1 BootstrapCOntextClosedEvent

无监听器监听

4. ApplicationPreparedEvent

EnvironmentPostProcesserApplicationListener
LoggingApplicationListener
BackgroundPreInitializer
DelegatingApplicationListener

4.1 ServletWebServerInitializedEvent

SpringApplicationAdminMXBeanRegistrar
DelegatingApplicationListener
ServerPortInfoApplicationContextInitializer

4.2 ContextRefreshedEvent

DelegatingApplicationListener
ConditionEvaluationReportLoggingListenerConditionEvaluationReportListener ClearCachesApplicationListener SharedMetadataReaderFactoryContextInitializerSharedMetadataReaderFactoryBean
RourceUrlProvider

5. ApplicationStartedEvent

BackgroundPreInitializer
DelegatingApplicationListener

5.1 AvailabilityChangeEvent

DelegatingApplicationListener
ApplicationAvailabilityBean

6. ApplicationReadyEvent

SpringApplicationAdminMXBeanRegistrar
BackgroundPreInitializer
DelegatingApplicationListener

6.1 AvailabilityChangeEvent

与5.1 同

相关文章

网友评论

      本文标题:Spring boot启动之事件发布

      本文链接:https://www.haomeiwen.com/subject/rpljwrtx.html