nacos config包主要引入了以下几个依赖(初始化组件)
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.alibaba.cloud.nacos.NacosConfigBootstrapConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.nacos.NacosConfigAutoConfiguration,\
com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration
org.springframework.boot.diagnostics.FailureAnalyzer=\
com.alibaba.cloud.nacos.diagnostics.analyzer.NacosConnectionFailureAnalyzer
- NacosConfigBootstrapConfiguration
public class NacosConfigBootstrapConfiguration {
@Bean
@ConditionalOnMissingBean
//初始化application里配置的参数
public NacosConfigProperties nacosConfigProperties() {
return new NacosConfigProperties();
}
@Bean
@ConditionalOnMissingBean
//初始化一个NacosConfigManager
public NacosConfigManager nacosConfigManager(
NacosConfigProperties nac