>通过SPI机制加载SpringApplicationRunListener实现类,定义在META-INF/spring.factories
# Run Listeners
org.springframework.boot.SpringApplicationRunListener=org.springframework.boot.context.event.EventPublishingRunListener
默认EventPublishingRunListener发布ApplicationStartingEvent事件
ApplicationArguments
创建environment
SERVLET
: StandardServletEnvironmentREACTIVE
:StandardReactiveWebEnvironmentdefault
:StandardEnvironment配置Environment
conversionService
发布ApplicationEnvironmentPreparedEvent
ConfigFileApplicationListener#onApplicationEnvironmentPreparedEvent -->
EnvironmentPostProcessor#postProcessEnvironment
web应用类型推断
servlet
:AnnotationConfigServletWebServerApplicationContextreactive
:AnnotationConfigReactiveWebServerApplicationContextdefault
:AnnotationConfigApplicationContextConversionService
ApplicationContextInitializer
:在容器refresh()之前初始化容器,通常用于注册Property sourcesApplicationContextInitializedEvent
事件ApplicationArguments
单例beanApplicationPreparedEvent
事件ApplicationStartedEvent
事件Springboot通过在容器真正启动前,提前对容器的行为做出相应的调整。并自定义了Spring应用上下文事件
SpringApplicationEvent
原文:https://www.cnblogs.com/chakawelkin/p/15156158.html