diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigProperties.java index e606bc834..29dbb60f1 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigProperties.java @@ -89,6 +89,11 @@ public class NacosConfigProperties { */ public static final String DEFAULT_NAMESPACE = "public"; + /** + * Nacos default server and port. + */ + public static final String DEFAULT_ADDRESS = "127.0.0.1:8848"; + private static final Pattern PATTERN = Pattern.compile("-(\\w)"); private static final Logger log = LoggerFactory @@ -561,7 +566,7 @@ public class NacosConfigProperties { */ public Properties assembleConfigServiceProperties() { Properties properties = new Properties(); - properties.put(SERVER_ADDR, Objects.toString(this.serverAddr, "")); + properties.put(SERVER_ADDR, Objects.toString(this.serverAddr, DEFAULT_ADDRESS)); properties.put(USERNAME, Objects.toString(this.username, "")); properties.put(PASSWORD, Objects.toString(this.password, "")); properties.put(ENCODE, Objects.toString(this.encode, ""));