mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
fix issue#1456
This commit is contained in:
@@ -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 + '\''
|
||||
|
@@ -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;
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user