Open xxw1754352621 opened 5 years ago
ConfigurationCondition 提供更细的颗粒度,控制配置类是否需要加载( offers more fine-grained control)
OnConsulEnabledCondition 继承 AllNestedConditions,必须实现OnConsulEnabledCondition 所有的嵌套条件才能成功注入和解析 这个类有两个条件:
@ConditionalOnProperty(value = "spring.cloud.consul.enabled", matchIfMissing = true)
static class FoundProperty {}
@ConditionalOnClass(ConsulClient.class)
static class FoundClass {}
所以上面的提示解析为,找到了ConsulClient客户端,没有匹配配置 参考: https://leokongwq.github.io/2017/05/28/springboot-autoconfiguration.html
不启动consul
spring.cloud.consul.enabled=false
AllNestedConditions 1 matched 1 did not; NestedCondition on ConditionalOnConsulEnabled.OnConsulEnabledCondition.FoundClass @ConditionalOnClass found required class 'com.ecwid.consul.v1.ConsulClient'; NestedCondition on ConditionalOnConsulEnabled.OnConsulEnabledCondition.FoundProperty @ConditionalOnProperty (spring.cloud.consul.enabled) found different value in property 'spring.cloud.consul.enabled' (ConditionalOnConsulEnabled.OnConsulEnabledCondition)