mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Merge pull request #394 from yunzheng1228/master
format code and fixed example's bug
This commit is contained in:
commit
dbfc363c02
4
pom.xml
4
pom.xml
@ -61,6 +61,10 @@
|
||||
<email>mercyblitz@gmail.com</email>
|
||||
<organization>Alibaba</organization>
|
||||
<url>https://github.com/mercyblitz</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>yunzheng</name>
|
||||
<email>yunzheng1228@gmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
spring.application.name=sca-nacos-config
|
||||
spring.application.name=nacos-config-example
|
||||
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.config.shared-data-ids=base-common.properties,common.properties
|
||||
spring.cloud.nacos.config.refreshable-dataids=common.properties
|
@ -57,7 +57,7 @@ import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;
|
||||
@ConfigurationProperties("spring.cloud.nacos.discovery")
|
||||
public class NacosDiscoveryProperties {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(NacosDiscoveryProperties.class);
|
||||
|
||||
/**
|
||||
@ -413,7 +413,7 @@ public class NacosDiscoveryProperties {
|
||||
namingService = NacosFactory.createNamingService(properties);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOGGER.error("create naming service error!properties={},e=,", this, e);
|
||||
log.error("create naming service error!properties={},e=,", this, e);
|
||||
return null;
|
||||
}
|
||||
return namingService;
|
||||
|
@ -33,7 +33,7 @@ import java.util.*;
|
||||
*/
|
||||
public class NacosDiscoveryClient implements DiscoveryClient {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(NacosDiscoveryClient.class);
|
||||
public static final String DESCRIPTION = "Spring Cloud Nacos Discovery Client";
|
||||
|
||||
@ -100,7 +100,7 @@ public class NacosDiscoveryClient implements DiscoveryClient {
|
||||
return services.getData();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOGGER.error("get service name from nacos server fail,", e);
|
||||
log.error("get service name from nacos server fail,", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import org.springframework.cloud.alibaba.nacos.NacosDiscoveryProperties;
|
||||
@Endpoint(id = "nacos-discovery")
|
||||
public class NacosDiscoveryEndpoint {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(NacosDiscoveryEndpoint.class);
|
||||
|
||||
private NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||
@ -61,7 +61,7 @@ public class NacosDiscoveryEndpoint {
|
||||
subscribe = namingService.getSubscribeServices();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOGGER.error("get subscribe services from nacos fail,", e);
|
||||
log.error("get subscribe services from nacos fail,", e);
|
||||
}
|
||||
result.put("subscribe", subscribe);
|
||||
return result;
|
||||
|
@ -31,7 +31,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class NacosAutoServiceRegistration
|
||||
extends AbstractAutoServiceRegistration<Registration> {
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(NacosAutoServiceRegistration.class);
|
||||
|
||||
private NacosRegistration registration;
|
||||
@ -65,7 +65,7 @@ public class NacosAutoServiceRegistration
|
||||
@Override
|
||||
protected void register() {
|
||||
if (!this.registration.getNacosDiscoveryProperties().isRegisterEnabled()) {
|
||||
LOGGER.debug("Registration disabled.");
|
||||
log.debug("Registration disabled.");
|
||||
return;
|
||||
}
|
||||
if (this.registration.getPort() < 0) {
|
||||
|
@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(NacosServiceRegistry.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(NacosServiceRegistry.class);
|
||||
|
||||
private final NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||
|
||||
@ -47,7 +47,7 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||
public void register(Registration registration) {
|
||||
|
||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||
logger.info("No service to register for nacos client...");
|
||||
log.warn("No service to register for nacos client...");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,11 +62,11 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||
|
||||
try {
|
||||
namingService.registerInstance(serviceId, instance);
|
||||
logger.info("nacos registry, {} {}:{} register finished", serviceId,
|
||||
log.info("nacos registry, {} {}:{} register finished", serviceId,
|
||||
instance.getIp(), instance.getPort());
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("nacos registry, {} register failed...{},", serviceId,
|
||||
log.error("nacos registry, {} register failed...{},", serviceId,
|
||||
registration.toString(), e);
|
||||
}
|
||||
}
|
||||
@ -74,10 +74,10 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||
@Override
|
||||
public void deregister(Registration registration) {
|
||||
|
||||
logger.info("De-registering from Nacos Server now...");
|
||||
log.info("De-registering from Nacos Server now...");
|
||||
|
||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||
logger.info("No dom to de-register for nacos client...");
|
||||
log.warn("No dom to de-register for nacos client...");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,11 +89,11 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
|
||||
registration.getPort(), nacosDiscoveryProperties.getClusterName());
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("ERR_NACOS_DEREGISTER, de-register failed...{},",
|
||||
log.error("ERR_NACOS_DEREGISTER, de-register failed...{},",
|
||||
registration.toString(), e);
|
||||
}
|
||||
|
||||
logger.info("De-registration finished.");
|
||||
log.info("De-registration finished.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class AnsServiceRegistry implements ServiceRegistry<AnsRegistration> {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||
log.info("No service to register for client...");
|
||||
log.warn("No service to register for client...");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class AnsServiceRegistry implements ServiceRegistry<AnsRegistration> {
|
||||
log.info("De-registering from ANSServer now...");
|
||||
|
||||
if (StringUtils.isEmpty(registration.getServiceId())) {
|
||||
log.info("No dom to de-register for client...");
|
||||
log.warn("No dom to de-register for client...");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user