|
|
|
@ -97,7 +97,7 @@ public enum SearchStrategy {
|
|
|
|
|
|
|
|
|
|
- 类图
|
|
|
|
|
|
|
|
|
|
![image-20200824085726621](../../images/SpringBoot//SpringBoot/image-20200824085726621.png)
|
|
|
|
|
![image-20200824085726621](../../images/SpringBoot/image-20200824085726621.png)
|
|
|
|
|
|
|
|
|
|
在看这部分源码之前需要先了解 `Conditional`和`Condition`的源码
|
|
|
|
|
|
|
|
|
@ -421,7 +421,7 @@ for (String type : spec.getTypes()) {
|
|
|
|
|
|
|
|
|
|
- 在忽略 bean 找到之后做一个类型移除的操作.
|
|
|
|
|
|
|
|
|
|
![image-20200825140750035](../../images/SpringBoot//image-20200825140750035.png)
|
|
|
|
|
![image-20200825140750035](../../images/SpringBoot/image-20200825140750035.png)
|
|
|
|
|
|
|
|
|
|
### 返回值
|
|
|
|
|
|
|
|
|
@ -469,7 +469,7 @@ public static ConditionOutcome noMatch(ConditionMessage message) {
|
|
|
|
|
return ConditionOutcome.match(matchMessage);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
![image-20200825141506531](../../images/SpringBoot//image-20200825141506531.png)
|
|
|
|
|
![image-20200825141506531](../../images/SpringBoot/image-20200825141506531.png)
|
|
|
|
|
|
|
|
|
|
- 到此结果封装完毕.回到方法`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`
|
|
|
|
|
|
|
|
|
|
![image-20200825092343271](../../images/SpringBoot//image-20200825092343271.png)
|
|
|
|
|
![image-20200825092343271](../../images/SpringBoot/image-20200825092343271.png)
|
|
|
|
|
|
|
|
|
|
- 获取类名或者方法名的结果是`MessageSourceAutoConfiguration`全路径
|
|
|
|
|
|
|
|
|
@ -592,8 +592,8 @@ org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
|
|
|
|
|
|
|
|
|
|
- 此时我们可以和前文的源码分析连接起来有一个完整的认识了
|
|
|
|
|
|
|
|
|
|
![image-20200825142332485](../../images/SpringBoot//image-20200825142332485.png)
|
|
|
|
|
![image-20200825142332485](../../images/SpringBoot/image-20200825142332485.png)
|
|
|
|
|
|
|
|
|
|
- 最后来看整体类图
|
|
|
|
|
|
|
|
|
|
![image-20200825142418115](../../images/SpringBoot//image-20200825142418115.png)
|
|
|
|
|
![image-20200825142418115](../../images/SpringBoot/image-20200825142418115.png)
|
|
|
|
|