fix: resolve wrong images path
This commit is contained in:
parent
232457b9e9
commit
b33c20bcc1
@ -97,7 +97,7 @@ public enum SearchStrategy {
|
||||
|
||||
- 类图
|
||||
|
||||

|
||||

|
||||
|
||||
在看这部分源码之前需要先了解 `Conditional`和`Condition`的源码
|
||||
|
||||
@ -421,7 +421,7 @@ for (String type : spec.getTypes()) {
|
||||
|
||||
- 在忽略 bean 找到之后做一个类型移除的操作.
|
||||
|
||||

|
||||

|
||||
|
||||
### 返回值
|
||||
|
||||
@ -469,7 +469,7 @@ public static ConditionOutcome noMatch(ConditionMessage message) {
|
||||
return ConditionOutcome.match(matchMessage);
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 到此结果封装完毕.回到方法`org.springframework.boot.autoconfigure.condition.SpringBootCondition#matches(org.springframework.context.annotation.ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata)` 继续进行
|
||||
- 再往后就继续执行 spring 的 bean 初始化咯
|
||||
@ -492,7 +492,7 @@ public static ConditionOutcome noMatch(ConditionMessage message) {
|
||||
|
||||
- 根据类的注解信息我们可以找到有`ResourceBundleCondition`
|
||||
|
||||

|
||||

|
||||
|
||||
- 获取类名或者方法名的结果是`MessageSourceAutoConfiguration`全路径
|
||||
|
||||
@ -592,8 +592,8 @@ org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
|
||||
|
||||
- 此时我们可以和前文的源码分析连接起来有一个完整的认识了
|
||||
|
||||

|
||||

|
||||
|
||||
- 最后来看整体类图
|
||||
|
||||

|
||||

|
||||
|
@ -33,7 +33,7 @@ public @interface ConfigurationPropertiesScan {}
|
||||
|
||||
## ConfigurationPropertiesScanRegistrar
|
||||
|
||||

|
||||

|
||||
|
||||
- debug 没有抓到后续补充
|
||||
|
||||
@ -137,11 +137,11 @@ public @interface EnableConfigurationProperties {
|
||||
|
||||
- 先看输入参数 **metadata**
|
||||
|
||||

|
||||

|
||||
|
||||
- getTypes 结果
|
||||
|
||||

|
||||

|
||||
|
||||
- 源码开始,先找出刚才的对象`org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration`
|
||||
|
||||
@ -192,7 +192,7 @@ public @interface EnableConfigurationProperties {
|
||||
|
||||
## ConfigurationPropertiesBindingPostProcessor
|
||||
|
||||

|
||||

|
||||
|
||||
### postProcessBeforeInitialization
|
||||
|
||||
@ -301,15 +301,15 @@ public @interface EnableConfigurationProperties {
|
||||
|
||||
- `annotation`
|
||||
|
||||

|
||||

|
||||
|
||||
- `bindType`
|
||||
|
||||

|
||||

|
||||
|
||||
- 返回对象
|
||||
|
||||

|
||||

|
||||
|
||||
- 此时数据还没有进去
|
||||
|
||||
@ -319,7 +319,7 @@ public @interface EnableConfigurationProperties {
|
||||
|
||||
直接看结果
|
||||
|
||||

|
||||

|
||||
|
||||
- 上述配置和我在配置文件中写的配置一致
|
||||
|
||||
@ -362,7 +362,7 @@ BindResult<?> bind(ConfigurationPropertiesBean propertiesBean) {
|
||||
}
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
##### findProperty
|
||||
|
||||
@ -428,11 +428,11 @@ BindResult<?> bind(ConfigurationPropertiesBean propertiesBean) {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
##### getBindHandler
|
||||
|
||||
@ -465,7 +465,7 @@ private <T> BindHandler getBindHandler(Bindable<T> target, ConfigurationProperti
|
||||
|
||||
- 最终获取得到的处理器
|
||||
|
||||

|
||||

|
||||
|
||||
- 最后的 bind
|
||||
|
||||
@ -499,7 +499,7 @@ private <T> BindHandler getBindHandler(Bindable<T> target, ConfigurationProperti
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
配置信息到此绑定成功,关于如何处理集合相关的配置请各位读者自行学习
|
||||
|
||||
|
@ -19,7 +19,7 @@ public enum LogLevel {
|
||||
|
||||
- `org.springframework.boot.logging.java.JavaLoggingSystem`
|
||||
|
||||

|
||||

|
||||
|
||||
```JAVA
|
||||
static {
|
||||
@ -128,7 +128,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 默认日志: `org.springframework.boot.logging.logback.LogbackLoggingSystem`
|
||||
|
||||
@ -136,7 +136,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
|
||||
|
||||
- 初始化之前
|
||||
|
||||

|
||||

|
||||
|
||||
- 链路
|
||||
1. `org.springframework.boot.context.logging.LoggingApplicationListener#onApplicationEvent`
|
||||
@ -352,9 +352,9 @@ public static LoggingSystem get(ClassLoader classLoader) {
|
||||
|
||||
- 添加配置文件
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
- 此时配置文件地址出现了
|
||||
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
2. 全局搜索 yml
|
||||
|
||||

|
||||

|
||||
|
||||
3. 换成`properties`搜索
|
||||
|
||||

|
||||

|
||||
|
||||
4. 我们以`yml`为例打上断点开始源码追踪
|
||||
|
||||
看到调用堆栈
|
||||
|
||||

|
||||

|
||||
|
||||
- 一步一步回上去看如何调用具体方法的
|
||||
|
||||
@ -29,9 +29,9 @@
|
||||
|
||||
### 调用过程
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
`org.springframework.boot.context.config.ConfigFileApplicationListener#addPropertySources`
|
||||
|
||||
@ -68,13 +68,13 @@ protected void addPropertySources(ConfigurableEnvironment environment, ResourceL
|
||||
|
||||
- 搜索目标: `org.springframework.boot.env.PropertySourceLoader`
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
观察发现里面有一个`YamlPropertySourceLoader`和我们之前找 yml 字符串的时候找到的类是一样的。说明搜索方式没有什么问题。
|
||||
|
||||

|
||||

|
||||
|
||||
初始化完成,后续进行解析了
|
||||
|
||||
@ -110,7 +110,7 @@ protected void addPropertySources(ConfigurableEnvironment environment, ResourceL
|
||||
### initializeProfiles
|
||||
|
||||
- 初始化`private Deque<Profile> profiles;` 属性
|
||||
- 
|
||||
- 
|
||||
|
||||
### load
|
||||
|
||||
@ -135,7 +135,7 @@ private void load(Profile profile, DocumentFilterFactory filterFactory, Document
|
||||
|
||||
- 资源路径可能性
|
||||
|
||||

|
||||

|
||||
|
||||
该方法采用循环每个路径下面都去尝试一遍
|
||||
|
||||
@ -190,7 +190,7 @@ private void load(Profile profile, DocumentFilterFactory filterFactory, Document
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- `PropertiesPropertySourceLoader`解析同理不在次展开描述了
|
||||
|
||||
|
@ -53,7 +53,7 @@ public @interface EnableAutoConfiguration {
|
||||
|
||||
- 类图
|
||||
|
||||

|
||||

|
||||
|
||||
## getAutoConfigurationMetadata()
|
||||
|
||||
@ -107,7 +107,7 @@ public @interface EnableAutoConfiguration {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- `protected static final String PATH = "META-INF/spring-autoconfigure-metadata.properties";`
|
||||
|
||||
@ -131,11 +131,11 @@ public @interface EnableAutoConfiguration {
|
||||
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
同样找一下 redis
|
||||
|
||||

|
||||

|
||||
|
||||
- 仔细看`org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration`类
|
||||
|
||||
@ -213,13 +213,13 @@ public class RedisProperties {
|
||||
|
||||
- `org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.AutoConfigurationGroup#process`
|
||||
|
||||

|
||||

|
||||
|
||||
再此之前我们看过了`getAutoConfigurationMetadata()`的相关操作
|
||||
|
||||
关注 `AnnotationMetadata annotationMetadata` 存储了一些什么
|
||||
|
||||

|
||||

|
||||
|
||||
这里简单理解
|
||||
|
||||
@ -271,7 +271,7 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### getCandidateConfigurations
|
||||
|
||||
@ -289,7 +289,7 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 第一个是我自己写的一个测试用
|
||||
|
||||
@ -341,7 +341,7 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 修改启动类
|
||||
|
||||
@ -350,7 +350,7 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### checkExcludedClasses
|
||||
|
||||
@ -418,7 +418,7 @@ public class RedisProperties {
|
||||
|
||||
- `getAutoConfigurationImportFilters()` 从`spring.factories` 获取 `AutoConfigurationImportFilter`的接口
|
||||
|
||||

|
||||

|
||||
|
||||
- 循环内执行`Aware`系列接口
|
||||
|
||||
@ -426,7 +426,7 @@ public class RedisProperties {
|
||||
|
||||
- `filter.match(candidates, autoConfigurationMetadata)` 比较判断哪些是需要自动注入的类
|
||||
|
||||

|
||||

|
||||
|
||||
### fireAutoConfigurationImportEvents
|
||||
|
||||
@ -448,11 +448,11 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- `AutoConfigurationImportEvent event = new AutoConfigurationImportEvent(this, configurations, exclusions);`
|
||||
|
||||

|
||||

|
||||
|
||||
- `org.springframework.boot.autoconfigure.AutoConfigurationImportListener#onAutoConfigurationImportEvent` 在执行自动配置时触发 , 实现类只有 **`ConditionEvaluationReportAutoConfigurationImportListener`**
|
||||
|
||||
@ -470,7 +470,7 @@ public class RedisProperties {
|
||||
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
- 初始化完
|
||||
|
||||
@ -478,7 +478,7 @@ public class RedisProperties {
|
||||
|
||||
- `org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.AutoConfigurationGroup#process`
|
||||
|
||||

|
||||

|
||||
|
||||
- 后续的一些行为相对简单,直接放个源码了.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user