mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
update nacos version to 0.2.1-RC and format code
This commit is contained in:
parent
e2b73fc3f0
commit
16d2c1b903
@ -18,7 +18,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<sentinel.version>0.1.1</sentinel.version>
|
<sentinel.version>0.1.1</sentinel.version>
|
||||||
<oss.version>3.1.0</oss.version>
|
<oss.version>3.1.0</oss.version>
|
||||||
<nacos.version>0.2.0</nacos.version>
|
<nacos.version>0.2.1-RC1</nacos.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<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
|
spring.application.name=service-consumer
|
||||||
server.port=18083
|
server.port=18083
|
||||||
management.endpoints.web.exposure.include=*
|
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
|
server.port=18082
|
||||||
spring.application.name=service-provider
|
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=*
|
management.endpoints.web.exposure.include=*
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.nacos.client;
|
package org.springframework.cloud.alibaba.nacos.client;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -81,10 +80,11 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
|
|||||||
Properties properties = getPropertiesFromEnv(env);
|
Properties properties = getPropertiesFromEnv(env);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
configService = NacosFactory.createConfigService(properties);
|
configService = NacosFactory.createConfigService(properties);
|
||||||
}
|
}
|
||||||
catch (NacosException e) {
|
catch (NacosException e) {
|
||||||
logger.error("create config service error, nacosConfigProperties:{}, ", properties, e);
|
logger.error("create config service error, nacosConfigProperties:{}, ",
|
||||||
|
properties, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,8 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
long timeout = nacosConfigProperties.getTimeout();
|
long timeout = nacosConfigProperties.getTimeout();
|
||||||
nacosPropertySourceBuilder = new NacosPropertySourceBuilder(configService, timeout);
|
nacosPropertySourceBuilder = new NacosPropertySourceBuilder(configService,
|
||||||
|
timeout);
|
||||||
|
|
||||||
String applicationName = env.getProperty("spring.application.name");
|
String applicationName = env.getProperty("spring.application.name");
|
||||||
logger.info("Initialize spring.application.name '" + applicationName + "'.");
|
logger.info("Initialize spring.application.name '" + applicationName + "'.");
|
||||||
@ -112,7 +113,8 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
|
|||||||
CompositePropertySource composite = new CompositePropertySource(
|
CompositePropertySource composite = new CompositePropertySource(
|
||||||
NACOS_PROPERTY_SOURCE_NAME);
|
NACOS_PROPERTY_SOURCE_NAME);
|
||||||
|
|
||||||
loadApplicationConfiguration(composite, env, nacosGroup, dataIdPrefix, contentType);
|
loadApplicationConfiguration(composite, env, nacosGroup, dataIdPrefix,
|
||||||
|
contentType);
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
@ -131,8 +133,9 @@ public class NacosPropertySourceLocator implements PropertySourceLocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadNacosDataIfPresent(final CompositePropertySource composite,
|
private void loadNacosDataIfPresent(final CompositePropertySource composite,
|
||||||
final String dataId, final String group,String contentType) {
|
final String dataId, final String group, String contentType) {
|
||||||
NacosPropertySource ps = nacosPropertySourceBuilder.build(dataId, group, contentType);
|
NacosPropertySource ps = nacosPropertySourceBuilder.build(dataId, group,
|
||||||
|
contentType);
|
||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
composite.addFirstPropertySource(ps);
|
composite.addFirstPropertySource(ps);
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|||||||
org.springframework.cloud.alibaba.nacos.NacosConfigAutoConfiguration,\
|
org.springframework.cloud.alibaba.nacos.NacosConfigAutoConfiguration,\
|
||||||
org.springframework.cloud.alibaba.nacos.endpoint.NacosConfigEndpointAutoConfiguration
|
org.springframework.cloud.alibaba.nacos.endpoint.NacosConfigEndpointAutoConfiguration
|
||||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
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() {
|
this.metaInfo = new MetaInfo() {
|
||||||
@Override
|
@Override
|
||||||
public String getAppName() {
|
public String getAppName() {
|
||||||
return instance.getService().getName();
|
return instance.serviceName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +56,7 @@ public class NacosServerList extends AbstractServerList<NacosServer> {
|
|||||||
private List<NacosServer> getServers() {
|
private List<NacosServer> getServers() {
|
||||||
try {
|
try {
|
||||||
List<Instance> instances = registration.getNacosNamingService()
|
List<Instance> instances = registration.getNacosNamingService()
|
||||||
.selectInstances(serviceId, true);
|
.getAllInstances(serviceId);
|
||||||
return instancesToServerList(instances);
|
return instancesToServerList(instances);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user