临时~spring启动过程

 

1. 创建createBootstrapContext

a) 包含ApplicationEventMulticaster(事件广播主要组件)

b) 所有Bootstrapper接口继承类被初始化(包括EurekaConfigServerBootstrapper.intitialize)

2. Spring.factories中加载SpringApplicationRunListener(用于监控springboot启动流程事件)

3. 生成DefaultApplicationArguments(main中args进行包装)

4. 核心:prepareEnvironment

a) getOrCreateEnvironment:创建environment

i. StandardServletEnvironment,(三个子类型ServletContextInitparams,ServletConfigInitParas)

ii. StandardEnvironment(包括systemEnvironment,systemProperties)

iii. StandardReactiveWebEnvironment(同上,暂时没有扩展逻辑)

b) configurePropertySources

c) 激发事件:listeners.environmentPrepared

d) bindToSpringApplication

5. printBanner

6. 核心prepareContext

a) 调用接口ApplicationContextInitializer

b) 激发事件:contextPrepared

c) 创建IOC容器()

d) 激发事件contextLoaded

7. 核心;refreshContext

a) 核心:调用org.springframework.context.support.AbstractApplicationContext#refresh

8. 核心:afterRefresh

9. 激发事件started

10. 调用方法callRunners(ApplicationRunner, CommandLineRunner)

 

Name_Generator: internalConfigurationBeanNameGenerator

 

1. SpringApplicationRunListener包含方法:

a) environmentPrepared(enviroment准备之后,applicationContext启动之前)

b) contextPrepared

c) contextLoaded

d) starting(run后直接调用,用来初始化)

e) started

posted @ 2021-09-11 15:34  龘人上天  阅读(35)  评论(0编辑  收藏  举报