0.@ConditionalOnMissingBean
@ConditionalOnMissingBean
//@ConditionalOnProperty(value = "pt1",matchIfMissing = true)
@Bean
public Letter letter(){
return new C();
}
以上配置为Configuration配置类内容,含义为如果容器中没有加载Letter对象,那么给将注解下面的配置加载,如果容器已经有Letter对象,那么此注解下的配置无效。
1.@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.watch.enabled", matchIfMissing = true)
参考https://www.jianshu.com/p/68a75c093023