update nacos version to 0.2.1-RC and format code

pull/36/head
flystar32 7 years ago
parent e2b73fc3f0
commit 16d2c1b903

@ -18,7 +18,7 @@
<properties>
<sentinel.version>0.1.1</sentinel.version>
<oss.version>3.1.0</oss.version>
<nacos.version>0.2.0</nacos.version>
<nacos.version>0.2.1-RC1</nacos.version>
</properties>
<dependencyManagement>

@ -1 +1 @@
spring.cloud.nacos.config.server-addr=127.0.0.1:8080
spring.cloud.nacos.config.server-addr=127.0.0.1:8848

@ -1,4 +1,4 @@
spring.application.name=service-consumer
server.port=18083
management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8080
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848

@ -1,4 +1,4 @@
server.port=18082
spring.application.name=service-provider
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8080
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
management.endpoints.web.exposure.include=*

@ -16,7 +16,6 @@
package org.springframework.cloud.alibaba.nacos.client;
import java.util.Properties;
import org.slf4j.Logger;
@ -81,13 +80,14 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
Properties properties = getPropertiesFromEnv(env);
try {
configService = NacosFactory.createConfigService(properties);
configService = NacosFactory.createConfigService(properties);
}
catch (NacosException e) {
logger.error("create config service error, nacosConfigProperties:{}, ", properties, e);
logger.error("create config service error, nacosConfigProperties:{}, ",
properties, e);
return null;
}
beanFactory.registerSingleton("configService", configService);
if (null == configService) {
@ -96,7 +96,8 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
return null;
}
long timeout = nacosConfigProperties.getTimeout();
nacosPropertySourceBuilder = new NacosPropertySourceBuilder(configService, timeout);
nacosPropertySourceBuilder = new NacosPropertySourceBuilder(configService,
timeout);
String applicationName = env.getProperty("spring.application.name");
logger.info("Initialize spring.application.name '" + applicationName + "'.");
@ -112,7 +113,8 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
CompositePropertySource composite = new CompositePropertySource(
NACOS_PROPERTY_SOURCE_NAME);
loadApplicationConfiguration(composite, env, nacosGroup, dataIdPrefix, contentType);
loadApplicationConfiguration(composite, env, nacosGroup, dataIdPrefix,
contentType);
return composite;
}
@ -131,8 +133,9 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
}
private void loadNacosDataIfPresent(final CompositePropertySource composite,
final String dataId, final String group,String contentType) {
NacosPropertySource ps = nacosPropertySourceBuilder.build(dataId, group, contentType);
final String dataId, final String group, String contentType) {
NacosPropertySource ps = nacosPropertySourceBuilder.build(dataId, group,
contentType);
if (ps != null) {
composite.addFirstPropertySource(ps);
}

@ -4,4 +4,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.alibaba.nacos.NacosConfigAutoConfiguration,\
org.springframework.cloud.alibaba.nacos.endpoint.NacosConfigEndpointAutoConfiguration
org.springframework.boot.diagnostics.FailureAnalyzer=\
org.springframework.cloud.alibaba.nacos..analyzer.NacosConnectionFailureAnalyzerdiagnostics
org.springframework.cloud.alibaba.nacos.diagnostics.analyzer.NacosConnectionFailureAnalyzer

@ -37,7 +37,7 @@ public class NacosServer extends Server {
this.metaInfo = new MetaInfo() {
@Override
public String getAppName() {
return instance.getService().getName();
return instance.serviceName();
}
@Override

@ -56,7 +56,7 @@ public class NacosServerList extends AbstractServerList<NacosServer> {
private List<NacosServer> getServers() {
try {
List<Instance> instances = registration.getNacosNamingService()
.selectInstances(serviceId, true);
.getAllInstances(serviceId);
return instancesToServerList(instances);
}
catch (Exception e) {

Loading…
Cancel
Save