《SpringBoot揭秘 快速构建微服务体系》读后感(三)
2024-09-08 04:38:27
SpringApplication:SpringBoot程序启动的一站式解决方案
深入探索SpringApplication执行流程
因为书上的版本是1.2的,比较老,这里参考http://blog.csdn.net/zxzzxzzxz123/article/details/69941910
public ConfigurableApplicationContext run(String... args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ConfigurableApplicationContext context = null;
FailureAnalyzers analyzers = null;
configureHeadlessProperty();
SpringApplicationRunListeners listeners = getRunListeners(args);
listeners.starting();
try {
ApplicationArguments applicationArguments = new DefaultApplicationArguments(
args);
ConfigurableEnvironment environment = prepareEnvironment(listeners,
applicationArguments);
Banner printedBanner = printBanner(environment);
context = createApplicationContext();
analyzers = new FailureAnalyzers(context);
prepareContext(context, environment, listeners, applicationArguments,
printedBanner);
refreshContext(context);
afterRefresh(context, applicationArguments);
listeners.finished(context, null);
stopWatch.stop();
if (this.logStartupInfo) {
new StartupInfoLogger(this.mainApplicationClass)
.logStarted(getApplicationLog(), stopWatch);
}
return context;
}
catch (Throwable ex) {
handleRunFailure(context, listeners, analyzers, ex);
throw new IllegalStateException(ex);
}
}
SpringApplicationRunListener
SpringApplicationRunListener是一个只有SpringBoot应用的main方法执行过程中接收不同执行时点时间通知的监听者
ApplicationListener
ApplicationContextInitializer
CommandLineRunner
最新文章
- centos7优化内核参数详解
- firefox浏览器不支持复制粘贴(linux)
- Android UI性能优化实战, 识别View中的性能问题
- C#反射动态调用dll中的方法
- Java Socket 模拟HTTP请求
- iOS - UIView操作(SWift)
- Call to undefined function imagettftext()解决方法
- css(display,float,position)
- Apache Kylin
- PHP的魔术方法(简介)
- Linux系统安装VM-Tools
- 实现 $.extend 的深复制和浅复制
- Codeforces Round #429 (Div. 2) 补题
- SpringMVC基础-controller方法中的参数注解
- Gitpage + hexo(3.0以上)搭建博客
- vue slot+传参
- list练习
- spring-boot(八) springboot整合shiro-登录认证和权限管理
- day04列表
- Vue之项目搭建
热门文章
- 【BZOJ4435】[Cerc2015]Juice Junctions Tarjan+hash
- Swift 学习笔记 (枚举)
- python使用记录
- 近年来世界各地ICO的花式骗局盘点
- php微信支付测试开发(流程已通)
- ajax 异步 跨域上传图片
- STS、Eclipse报java.lang.OutOfMemoryError: PermGen space 内存溢出
- jQuery(expression, [context])
- 算法(Algorithms)第4版 练习 链表类 1.3.19~1.3.29
- hihocoder1075【开锁魔法】