mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
parent
1a23c76689
commit
26df5b7926
@ -17,6 +17,7 @@
|
|||||||
package org.springframework.cloud.alibaba.nacos;
|
package org.springframework.cloud.alibaba.nacos;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.cloud.alibaba.nacos.client.NacosPropertySourceLocator;
|
import org.springframework.cloud.alibaba.nacos.client.NacosPropertySourceLocator;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -34,6 +35,7 @@ public class NacosConfigBootstrapConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnProperty(name = "spring.cloud.nacos.config.enabled", matchIfMissing = true)
|
||||||
public NacosPropertySourceLocator nacosPropertySourceLocator(
|
public NacosPropertySourceLocator nacosPropertySourceLocator(
|
||||||
NacosConfigProperties nacosConfigProperties) {
|
NacosConfigProperties nacosConfigProperties) {
|
||||||
return new NacosPropertySourceLocator(nacosConfigProperties);
|
return new NacosPropertySourceLocator(nacosConfigProperties);
|
||||||
|
@ -53,6 +53,11 @@ public class NacosConfigProperties {
|
|||||||
|
|
||||||
private static final Log log = LogFactory.getLog(NacosConfigProperties.class);
|
private static final Log log = LogFactory.getLog(NacosConfigProperties.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* whether to enable nacos config.
|
||||||
|
*/
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nacos config server address
|
* nacos config server address
|
||||||
*/
|
*/
|
||||||
@ -145,6 +150,14 @@ public class NacosConfigProperties {
|
|||||||
|
|
||||||
// todo sts support
|
// todo sts support
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public String getServerAddr() {
|
public String getServerAddr() {
|
||||||
return serverAddr;
|
return serverAddr;
|
||||||
}
|
}
|
||||||
@ -322,16 +335,17 @@ public class NacosConfigProperties {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NacosConfigProperties{" + "serverAddr='" + serverAddr + '\''
|
return "NacosConfigProperties{" + "enabled=" + enabled + ", serverAddr='"
|
||||||
+ ", encode='" + encode + '\'' + ", group='" + group + '\''
|
+ serverAddr + '\'' + ", encode='" + encode + '\'' + ", group='" + group
|
||||||
+ ", sharedDataids='" + this.sharedDataids + '\''
|
+ '\'' + ", prefix='" + prefix + '\'' + ", fileExtension='"
|
||||||
+ ", refreshableDataids='" + this.refreshableDataids + '\'' + ", prefix='"
|
+ fileExtension + '\'' + ", timeout=" + timeout + ", endpoint='"
|
||||||
+ prefix + '\'' + ", fileExtension='" + fileExtension + '\''
|
+ endpoint + '\'' + ", namespace='" + namespace + '\'' + ", accessKey='"
|
||||||
+ ", timeout=" + timeout + ", endpoint='" + endpoint + '\''
|
+ accessKey + '\'' + ", secretKey='" + secretKey + '\''
|
||||||
+ ", namespace='" + namespace + '\'' + ", accessKey='" + accessKey + '\''
|
+ ", contextPath='" + contextPath + '\'' + ", clusterName='" + clusterName
|
||||||
+ ", secretKey='" + secretKey + '\'' + ", contextPath='" + contextPath
|
+ '\'' + ", name='" + name + '\'' + ", activeProfiles="
|
||||||
+ '\'' + ", clusterName='" + clusterName + '\'' + ", name='" + name + '\''
|
+ Arrays.toString(activeProfiles) + ", sharedDataids='" + sharedDataids
|
||||||
+ ", activeProfiles=" + Arrays.toString(activeProfiles) + '}';
|
+ '\'' + ", refreshableDataids='" + refreshableDataids + '\''
|
||||||
|
+ ", extConfig=" + extConfig + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigService configServiceInstance() {
|
public ConfigService configServiceInstance() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user