Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d5cc691

Browse files
committed
add springboot start the process markdown
1 parent 5b9e077 commit d5cc691

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## SpringBoot 2.1.x 框架整体启动流程
2+
3+
### 1、框架初始化步骤
4+
5+
#### 框架初始化步骤-脑图
6+
7+
<img src="https://tva1.sinaimg.cn/large/008i3skNly1gr7mstd139j311w0u01cb.jpg" alt="image-20210605194919123" width="500" align="left" />
8+
9+
#### 框架初始化步骤-源代码
10+
11+
> SpringBoog启动类:org.springframework.boot.SpringApplication
12+
13+
```java
14+
@SuppressWarnings({ "unchecked", "rawtypes" })
15+
public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) {
16+
// 配置资源加载器
17+
this.resourceLoader = resourceLoader;
18+
Assert.notNull(primarySources, "PrimarySources must not be null");
19+
20+
// 配置primarySources
21+
this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources));
22+
23+
// 应用环境检测
24+
this.webApplicationType = WebApplicationType.deduceFromClasspath();
25+
26+
// 配置系统初始化器
27+
setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class));
28+
29+
// 配置应用监听器
30+
setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));
31+
32+
// 配置main方法所在的类
33+
this.mainApplicationClass = deduceMainApplicationClass();
34+
}
35+
```
36+
37+
38+
39+
### 2、启动框架
40+
41+
#### 启动框架-流程
42+
43+
<img src="https://tva1.sinaimg.cn/large/008i3skNly1gr7n4t8byxj32840u0b29.jpg" alt="image-20210605200051981" align="left" width="1000" />
44+
45+
46+
47+
### 3、框架自动化装配步骤
48+
49+
#### 自动化装配-脑图
50+
51+
<img src="https://tva1.sinaimg.cn/large/008i3skNly1gr7n6t3qd2j31n80ju12l.jpg" alt="image-20210605200241401" width="500" align="left" />
52+
53+
54+
55+
56+
57+
### 4、SpringBoot上下文
58+
59+
#### 准备上下文流程
60+
61+
<img src="https://tva1.sinaimg.cn/large/008i3skNly1gr7nby7ctij30y40t4dt7.jpg" alt="image-20210605200740395" width="650" align="left" />
62+
63+
64+
65+
#### 刷新上下文流程
66+
67+
<img src="https://tva1.sinaimg.cn/large/008i3skNly1gr7ngcduz6j31ym0u07ql.jpg" alt="image-20210605201154951" align="left" />
68+

springboot-source-code-analysis/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.4.0</version>
8+
<version>2.1.7.RELEASE</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.ipman.source.code.analysis.springboot</groupId>

springboot-source-code-analysis/src/test/java/com/example/springboot/source/code/analysis/SpringbootSourceCodeAnalysisApplicationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.example.springboot.source.code.analysis;
22

3-
import org.junit.jupiter.api.Test;
3+
import org.junit.Test;
44
import org.springframework.boot.test.context.SpringBootTest;
55

66
@SpringBootTest

0 commit comments

Comments
 (0)