1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Merge pull request #282 from pbting/master

nacos config bug fix
This commit is contained in:
format 2019-01-17 15:42:31 +08:00 committed by GitHub
commit 2a39bca22f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -16,9 +16,7 @@
package org.springframework.cloud.alibaba.nacos.client; package org.springframework.cloud.alibaba.nacos.client;
import java.util.Arrays; import com.alibaba.nacos.api.config.ConfigService;
import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties; import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
@ -31,7 +29,8 @@ import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertySource; import org.springframework.core.env.PropertySource;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.alibaba.nacos.api.config.ConfigService; import java.util.Arrays;
import java.util.List;
/** /**
* @author xiaojing * @author xiaojing
@ -186,12 +185,17 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
private static void checkDataIdFileExtension(String[] sharedDataIdArry) { private static void checkDataIdFileExtension(String[] sharedDataIdArry) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < sharedDataIdArry.length; i++) { for (int i = 0; i < sharedDataIdArry.length; i++) {
boolean isLegal = false;
for (String fileExtension : SUPPORT_FILE_EXTENSION) { for (String fileExtension : SUPPORT_FILE_EXTENSION) {
if (sharedDataIdArry[i].indexOf(fileExtension) > 0) { if (sharedDataIdArry[i].indexOf(fileExtension) > 0) {
isLegal = true;
break; break;
} }
} }
stringBuilder.append(sharedDataIdArry[i] + ","); // add tips
if (!isLegal) {
stringBuilder.append(sharedDataIdArry[i] + ",");
}
} }
if (stringBuilder.length() > 0) { if (stringBuilder.length() > 0) {

View File

@ -16,6 +16,11 @@
package org.springframework.cloud.alicloud.ans.registry; package org.springframework.cloud.alicloud.ans.registry;
import java.net.URI;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.cloud.alicloud.context.ans.AnsProperties; import org.springframework.cloud.alicloud.context.ans.AnsProperties;
import org.springframework.cloud.client.DefaultServiceInstance; import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.ServiceInstance;
@ -25,10 +30,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import java.net.URI;
import java.util.Map;
/** /**
* @author xiaolongzuo * @author xiaolongzuo
*/ */
@ -64,11 +65,6 @@ public class AnsRegistration implements Registration, ServiceInstance {
metadata.put(MANAGEMENT_ADDRESS, address); metadata.put(MANAGEMENT_ADDRESS, address);
} }
} }
String serverPort = env.getProperty("server.port");
if (null != serverPort) {
this.setPort(Integer.valueOf(serverPort));
}
} }
@Override @Override