1.这个类执行逻辑:
(1)通过构造函数初始化Application Listeners和Application Context Initializers(采用SPI设计,从spring boot源码META-INF/spring.factories配置中抓取实现类)
(2)run方法:这里不做详细展开分析,后续展开
第1步:执行应用监听器(listeners.started())
第2步:创建spring系统环境对象(StandardServletEnvironment或者StandardEnvironment)
第3步:初始化spring系统环境的属性源MutablePropertySources
第4步:创建spring应用上下文(AnnotationConfigEmbeddedWebApplicationContext或AnnotationConfigApplicationContext)
第5步:初始化spring应用上下文:添加一个BeanFactoryPostProcessor.
context.addBeanFactoryPostProcessor(new ConfigurationWarningsApplicationContextInitializer.ConfigurationWarningsPostProcessor(this.getChecks()))
第6步:加载beanDefinition: 默认扫描SpringApplication启动目录和子目录class。
this.load(context, sources.toArray(new Object[sources.size()]));
第7步:扩展方法: this.refresh(context);
这里主要执行:
this.postProcessBeanFactory(beanFactory);
this.invokeBeanFactoryPostProcessors(beanFactory);//定制beanDefinition,这里面通过抓取class的注解做了很多事情,
this.registerBeanPostProcessors(beanFactory);//定制bean
this.initMessageSource();
this.initApplicationEventMulticaster();
this.onRefresh(); //EmbeddedWebApplicationContext重写了这个方法实现内嵌web容器
this.registerListeners();
this.finishBeanFactoryInitialization(beanFactory);
this.finishRefresh();
2.时序图,---待补充
相关推荐
赠送jar包:spring-boot-configuration-processor-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-configuration-processor-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-configuration-processor-...
赠送jar包:spring-boot-autoconfigure-2.5.5.jar; 赠送原API文档:spring-boot-autoconfigure-2.5.5-javadoc.jar; 赠送源代码:spring-boot-autoconfigure-2.5.5-sources.jar; 赠送Maven依赖信息文件:spring-...
赠送jar包:spring-boot-autoconfigure-2.6.3.jar; 赠送原API文档:spring-boot-autoconfigure-2.6.3-javadoc.jar; 赠送源代码:spring-boot-autoconfigure-2.6.3-sources.jar; 赠送Maven依赖信息文件:spring-...
赠送jar包:druid-spring-boot-starter-1.1.9.jar; 赠送原API文档:druid-spring-boot-starter-1.1.9-javadoc.jar; 赠送源代码:druid-spring-boot-starter-1.1.9-sources.jar; 赠送Maven依赖信息文件:druid-...
赠送jar包:druid-spring-boot-starter-1.2.8.jar; 赠送原API文档:druid-spring-boot-starter-1.2.8-javadoc.jar; 赠送源代码:druid-spring-boot-starter-1.2.8-sources.jar; 赠送Maven依赖信息文件:druid-...
赠送jar包:spring-boot-actuator-autoconfigure-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.3.12....
赠送jar包:spring-boot-configuration-processor-2.5.6.jar; 赠送原API文档:spring-boot-configuration-processor-2.5.6-javadoc.jar; 赠送源代码:spring-boot-configuration-processor-2.5.6-sources.jar; ...
赠送jar包:spring-boot-test-2.2.8.RELEASE.jar; 赠送原API文档:spring-boot-test-2.2.8.RELEASE-javadoc.jar; 赠送源代码:spring-boot-test-2.2.8.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-boot-...
赠送jar包:aliyun-sms-spring-boot-starter-2.0.2.jar; 赠送原API文档:aliyun-sms-spring-boot-starter-2.0.2-javadoc.jar; 赠送源代码:aliyun-sms-spring-boot-starter-2.0.2-sources.jar; 赠送Maven依赖信息...
赠送jar包:spring-boot-configuration-processor-2.6.3.jar; 赠送原API文档:spring-boot-configuration-processor-2.6.3-javadoc.jar; 赠送源代码:spring-boot-configuration-processor-2.6.3-sources.jar; ...
赠送jar包:seata-spring-boot-starter-1.3.0.jar; 赠送原API文档:seata-spring-boot-starter-1.3.0-javadoc.jar; 赠送源代码:seata-spring-boot-starter-1.3.0-sources.jar; 赠送Maven依赖信息文件:seata-...
赠送jar包:spring-boot-actuator-autoconfigure-2.2.0.RELEASE.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.2.0....
赠送jar包:dynamic-datasource-spring-boot-starter-3.4.1.jar; 赠送原API文档:dynamic-datasource-spring-boot-starter-3.4.1-javadoc.jar; 赠送源代码:dynamic-datasource-spring-boot-starter-3.4.1-sources...
赠送jar包:spring-boot-actuator-autoconfigure-2.6.3.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.6.3-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.6.3-sources.jar; 赠送...
赠送jar包:oss-spring-boot-starter-1.0.3.jar; 赠送原API文档:oss-spring-boot-starter-1.0.3-javadoc.jar; 赠送源代码:oss-spring-boot-starter-1.0.3-sources.jar; 赠送Maven依赖信息文件:oss-spring-boot...
赠送jar包:spring-boot-admin-server-ui-2.5.2.jar; 赠送原API文档:spring-boot-admin-server-ui-2.5.2-javadoc.jar; 赠送源代码:spring-boot-admin-server-ui-2.5.2-sources.jar; 赠送Maven依赖信息文件:...
赠送jar包:spring-boot-test-autoconfigure-2.0.6.RELEASE.jar; 赠送原API文档:spring-boot-test-autoconfigure-2.0.6.RELEASE-javadoc.jar; 赠送源代码:spring-boot-test-autoconfigure-2.0.6.RELEASE-sources...
赠送jar包:mybatis-spring-boot-autoconfigure-1.3.2.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-1.3.2-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-1.3.2-sources.jar; 赠送...
赠送jar包:spring-boot-actuator-autoconfigure-2.5.5.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.5.5-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.5.5-sources.jar; 赠送...
赠送jar包:nacos-config-spring-boot-autoconfigure-0.2.7.jar; 赠送原API文档:nacos-config-spring-boot-autoconfigure-0.2.7-javadoc.jar; 赠送源代码:nacos-config-spring-boot-autoconfigure-0.2.7-sources...