微服务相关知识点
2023-09-17 21:40:40 6 举报
AI智能生成
登录查看完整内容
为你推荐
查看更多
spring boot启动原理
作者其他创作
大纲/内容
添加获取TomcatServer的Bean
添加获取JettyServer的bean
添加获取undertowServer的bean
添加Import注解,导入WebServerAutoConfiguration
初始化容器
获取每一个Server上面的@ConditionOnClass上面配置的value,根据value通过classloader加载,如果能够加载上说明导入了相关的依赖
获取webSever容器
ico容器启动重写onfresh调用启动tomcat容器
启动容器
SpringBootApplication.run
获取所有的META_INFO/下所有配置的类信息 // getCandidateConfigurations
移除重复的类型 // removeDuplicates(configurations);
移除增加了排除注解// font color=\"#e74f4c\
OnBeanCondition
OnClassCondition
OnWebApplicationCondition
过滤 font color=\"#e74f4c\
getAutoConfigurationEntry// 加载配置类
@Import({AutoConfigurationImportSelector.class})
开启EnableAutoConfiguration
开启SpringBootApplication注解
spring boot的自动装配原理
NONE
SERVLET
REACTIVE
推断当前容器的类型
设置初始化器,初始化器从factory.service当中获取ApplicationContextInitializer
设置监听器,监听器从factory.service当中ApplicationListener
设置main方法的入口
初始化SpringApplication new SpringApplication(primarySources))
starting
SpringApplicationRunListeners
发布容器启动的监听事件
获取java、system、操作系统的环境变量
environmentPrepared
读取环境变量和全局变量
打印banner
AnnotationConfigServletWebServerApplicationContext
AnnotationConfigReactiveWebServerApplicationContext
AnnotationConfigApplicationContext
DEFAULT
创建Spring boot容器
设置容器的环境context.setEnvironment(environment);
ApplicationContextInitializer.initialize
执行容器的初始化器的初始化方法applyInitializers
contextPrepared
发布容器的准备监听事件listeners.contextPrepared
将容器参数注册成bean
LazyInitializationBeanFactoryPostProcessor
如果是懒加载,增加beanFactory的后置处理器
load
加载容器
contextLoaded
发布容器加载事件
容器的准备 //prepareContext
ConfigurationBeanFactoryPostProcessor
通过BeanFactory的后置处理器解析@Import的相关注解,并执行bean的相关方法
启动TomcatServer
重写onRefresh
AnnotationConfigServletWebServerApplicationContext.refresh
容器的刷新
模板方法未实现
容器的加载之后
started
发布容器启动时间
运行run方法
spring boot的启动流程
spring boot相关原理
自定义start
spring boot
微服务相关知识
0 条评论
回复 删除
下一页