Spring Boot启动过程(三)
我已经很精简了,两篇(Spring Boot启动过程(一)、pring Boot启动过程(二))依然没写完,接着来。
refreshContext之后的方法是afterRefresh,这名字起的真...好。afterRefresh方法内只调用了callRunners一个方法,这个方法从上下文中获取了所有的ApplicationRunner和CommandLineRunner接口的实现类,并执行这些实现类的run方法。例如Spring Batch的JobLauncherCommandLineRunner:
@Override
public void run(String... args) throws JobExecutionException {
logger.info("Running default command line with: " + Arrays.asList(args));
launchJobFromProperties(StringUtils.splitArrayElementsIntoProperties(args, "="));
}
listeners.finished(context, null)实际上是在exception为null的情况下发布了ApplicationReadyEvent事件。
启动至此就差不多了,于是停止stopWatch.stop(),然后把时间打到日志里:Started Application in ***.462 seconds (JVM running for ***.977),然后感受下这记完就扔的气势:
if (this.logStartupInfo) {
new StartupInfoLogger(this.mainApplicationClass)
.logStarted(getApplicationLog(), stopWatch);
}
最后返回个context,run方法就到此结束了。
==========================================================
咱最近用的github:https://github.com/saaavsaaa
微信公众号:

Spring Boot启动过程(三)的更多相关文章
- Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动
之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void cr ...
- Spring Boot启动过程(七):Connector初始化
Connector实例的创建已经在Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动中提到了: Connector是LifecycleMBeanBase的子类,先是设置L ...
- Spring Boot启动过程及回调接口汇总
Spring Boot启动过程及回调接口汇总 链接: https://www.itcodemonkey.com/article/1431.html 来自:chanjarster (Daniel Qia ...
- Spring Boot 启动过程
一切从SpringApplication.run()开始,最终返回一个ConfigurableApplicationContext 构造了一个SpringApplication对象,然后调用它的run ...
- Spring Boot启动过程(一)
之前在排查一个线上问题时,不得不仔细跑了很多遍Spring Boot的代码,于是整理一下,我用的是1.4.3.RELEASE. 首先,普通的入口,这没什么好说的,我就随便贴贴代码了: SpringAp ...
- 转:Spring Boot启动过程
之前在排查一个线上问题时,不得不仔细跑了很多遍Spring Boot的代码,于是整理一下,我用的是1.4.3.RELEASE. 首先,普通的入口,这没什么好说的,我就随便贴贴代码了: SpringAp ...
- Spring Boot启动过程(二)
书接上篇 该说refreshContext(context)了,首先是判断context是否是AbstractApplicationContext派生类的实例,之后调用了强转为AbstractAppl ...
- Spring Boot 启动过程及 自定义 Listener等组件
一.启动过程 二.自定义组件 package com.example.jdbc.listener; import org.springframework.context.ApplicationCont ...
- Spring boot 启动过程解析 logback
使用 Spring Boot 默认的日志框架 Logback. 所有这些 POM 依赖的好处在于为开发 Spring 应用提供了一个良好的基础.Spring Boot 所选择的第三方库是经过考虑的,是 ...
随机推荐
- sqoop安装配置
下载 sqoop-1.4.5 安装包 配置 sqoop-env.sh #Set path to where bin/hadoop is available 配置Hadoop export HADOOP ...
- UNITY 多SCENE加载与编辑
Unity内部场景的加载分为两步: Loading.是指从文件.内存(主要是Streamed scene AssetBundle)中加载Scene的内容,创建并读取所有相关的Game objects. ...
- C和C++中的不定参数
在初学C的时候,我们都会用到printf函数来写Hello World的程序.在我们看printf函数的声明时,会看到类似于下面代码 int printf(const char * __restric ...
- 不要怂,就是GAN (生成式对抗网络) (三):判别器和生成器 TensorFlow Model
在 /home/your_name/TensorFlow/DCGAN/ 下新建文件 utils.py,输入如下代码: import scipy.misc import numpy as np # 保存 ...
- 邹欣,现代软件工程讲义:单元测试&回归测试
http://www.cnblogs.com/xinz/archive/2011/11/20/2255830.html 邹欣, 现代软件工程讲义 2 开发技术 - 单元测试 & 回归测试
- javadoc tags
Where Tags Can Be Used The following sections describe where the tags can be used. Note that these t ...
- linux每天一小步---touch命令详解
1 命令功能: 创建文件和修改文件或者目录的时间戳 2 命令语法: touch [选项] [文件名或者目录名] 3 命令参数: -a 只修改文件的access(访问)时间. -c 或-- ...
- canvas里调用getImageData的报security的问题
canvas元素支持绘制任意图片元素: var ctx = document.getElementById("canvas").getContext("2d") ...
- handsontable-developer guide-cell type
单元格类型:这里有很多没见过的用法,得好好总结一下 //预定义的类型Text Numeric Checkbox Date Select Dropdown Autocomplete Password H ...
- AndroidStudio-永远无法进入
由于出现了莫名其妙的,AndroidStudio已过时错误信息 就去删除了: C:\Users\Administrator\.android C:\Users\Administrator\.Andro ...