|
|
@ -51,6 +51,23 @@ public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
|
|
|
|
@Value("${spring.cloud.nacos.discovery.namespace:#{null}}")
|
|
|
|
@Value("${spring.cloud.nacos.discovery.namespace:#{null}}")
|
|
|
|
private String namespace;
|
|
|
|
private String namespace;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* nacos groupName
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Value("${spring.cloud.nacos.config.group:DEFAULT_GROUP:#{null}}")
|
|
|
|
|
|
|
|
private String group;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* nacos username
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Value("${spring.cloud.nacos.discovery.username:#{null}}")
|
|
|
|
|
|
|
|
private String username;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* nacos password
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Value("${spring.cloud.nacos.discovery.password:#{null}}")
|
|
|
|
|
|
|
|
private String password;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Swagger中需要排除的服务
|
|
|
|
* Swagger中需要排除的服务
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -117,14 +134,21 @@ public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
|
|
|
|
Properties properties=new Properties();
|
|
|
|
Properties properties=new Properties();
|
|
|
|
properties.setProperty("serverAddr",serverAddr);
|
|
|
|
properties.setProperty("serverAddr",serverAddr);
|
|
|
|
if(namespace!=null && !"".equals(namespace)){
|
|
|
|
if(namespace!=null && !"".equals(namespace)){
|
|
|
|
|
|
|
|
log.info("nacos.discovery.namespace = {}", namespace);
|
|
|
|
properties.setProperty("namespace",namespace);
|
|
|
|
properties.setProperty("namespace",namespace);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(username!=null && !"".equals(username)){
|
|
|
|
|
|
|
|
properties.setProperty("username",username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(password!=null && !"".equals(password)){
|
|
|
|
|
|
|
|
properties.setProperty("password",password);
|
|
|
|
|
|
|
|
}
|
|
|
|
//【issues/5115】因swagger文档导致gateway内存溢出
|
|
|
|
//【issues/5115】因swagger文档导致gateway内存溢出
|
|
|
|
if (this.naming == null) {
|
|
|
|
if (this.naming == null) {
|
|
|
|
this.naming = NamingFactory.createNamingService(properties);
|
|
|
|
this.naming = NamingFactory.createNamingService(properties);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info(" config.group : {}", group);
|
|
|
|
List<Instance> list = this.naming.selectInstances(routeId, true);
|
|
|
|
List<Instance> list = this.naming.selectInstances(routeId, group , true);
|
|
|
|
if (ObjectUtil.isNotEmpty(list)) {
|
|
|
|
if (ObjectUtil.isNotEmpty(list)) {
|
|
|
|
hasRoute = true;
|
|
|
|
hasRoute = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|