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

Merge pull request #22 from alibaba/master

update
This commit is contained in:
余黄彬 2020-05-20 17:38:52 +08:00 committed by GitHub
commit 6411a24719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,7 @@
server.port=18082
spring.application.name=service-provider
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
#spring.cloud.nacos.discovery.instance-enabled=true
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

View File

@ -199,6 +199,11 @@ public class NacosDiscoveryProperties {
*/
private Integer ipDeleteTimeout;
/**
* If instance is enabled to accept request. The default value is true.
*/
private boolean instanceEnabled = true;
@Autowired
private InetUtils inetUtils;
@ -448,6 +453,14 @@ public class NacosDiscoveryProperties {
this.password = password;
}
public boolean isInstanceEnabled() {
return instanceEnabled;
}
public void setInstanceEnabled(boolean instanceEnabled) {
this.instanceEnabled = instanceEnabled;
}
@Override
public String toString() {
return "NacosDiscoveryProperties{" + "serverAddr='" + serverAddr + '\''

View File

@ -159,6 +159,7 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
instance.setPort(registration.getPort());
instance.setWeight(nacosDiscoveryProperties.getWeight());
instance.setClusterName(nacosDiscoveryProperties.getClusterName());
instance.setEnabled(nacosDiscoveryProperties.isInstanceEnabled());
instance.setMetadata(registration.getMetadata());
return instance;

View File

@ -23,6 +23,12 @@
"defaultValue": true,
"description": "enable nacos discovery or not."
},
{
"name": "spring.cloud.nacos.discovery.instance-enabled",
"type": "java.lang.Boolean",
"defaultValue": true,
"description": "If instance is enabled to accept request. The default value is true."
},
{
"name": "spring.cloud.nacos.discovery.namingLoadCacheAtStart",
"type": "java.lang.Boolean",