spring boot
2020-07-01 16:09:00 0 举报
AI智能生成
Spring boot 启动过程
作者其他创作
大纲/内容
SpringApplication#run
getRunListeners() 查询 SpringApplicationRunListener
getSpringFactoriesInstances -> SpringApplicationRunListener
listeners.starting()
ApplicationStartingEvent
LoggingApplicationListener
BackgroundPreinitializer
DelegatingApplicationListener
LiquibaseServiceLocatorApplicationListener
prepareEnvironment()
getOrCreateEnvironment
new StandardServletEnvironment()
configureEnvironment
listeners.environmentPrepared(environment)
ApplicationEnvironmentPreparedEvent
BootstrapApplicationListener
LoggingSystemShutdownListener
ConfigFileApplicationListener
加载配置信息
加载apollo 配置
ApolloApplicationContextInitializer#postProcessEnvironment
ConfigService#getConfig
DefaultConfigManager#getConfig
DefaultConfigFactory#create
RemoteConfigRepository#sync http请求apollo 服务器
配置更新 = 定时拉取 + 长轮询
子主题
LoggingApplicationListener
子主题
子主题
bindToSpringApplication
printBanner(environment) 打印 banner
createApplicationContext() 创建应用上下文
prepareContext()
listeners.contextPrepared(context)
ApplicationContextInitializedEvent
listeners.contextLoaded(context)
ApplicationPreparedEvent
refreshContext()
AbstractApplicationContext#refresh
prepareRefresh
obtainFreshBeanFactory
prepareBeanFactory
postProcessBeanFactory
invokeBeanFactoryPostProcessors
registerBeanPostProcessors
initMessageSource
initApplicationEventMulticaster
onRefresh
registerListeners
finishBeanFactoryInitialization
finishRefresh eureka 注册 & 拉数据
clearResourceCaches
initLifecycleProcessor
getLifecycleProcessor().onRefresh()
publishEvent
LiveBeansView.registerApplicationContext(this)
startWebServer()
afterRefresh()
listeners.started(context)
ApplicationStartedEvent
listeners.running(context)
ApplicationReadyEvent
SpringApplicationRunListener#failed()
ApplicationFailedEvent
0 条评论
下一页