Merge branch 'master' into eureka

# Conflicts:
#	sop-gateway/pom.xml
#	sop-website/pom.xml
#	sop-website/sop-website-server/pom.xml
eureka
tanghc 4 years ago
commit f33d69c139
  1. 3
      README.md
  2. 4
      changelog.md
  3. 64
      doc/docs/_sidebar.md
  4. 94
      doc/docs/files/10088_自定义过滤器.md
  5. 0
      doc/docs/files/10091_路由授权.md
  6. 6
      doc/docs/files/90001_网关性能测试.md
  7. 3
      doc/docs/files/90100_常见问题.md
  8. 2
      doc/pom.xml
  9. 2
      pom.xml
  10. 4
      sop-admin/pom.xml
  11. 4
      sop-admin/sop-admin-server/pom.xml
  12. 5
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/impl/RegistryServiceNacosImpl.java
  13. 6
      sop-auth/pom.xml
  14. 2
      sop-common/pom.xml
  15. 6
      sop-common/sop-bridge-eureka/pom.xml
  16. 6
      sop-common/sop-bridge-nacos/pom.xml
  17. 6
      sop-common/sop-bridge-nacos/src/main/java/com/gitee/sop/bridge/route/NacosRegistryListener.java
  18. 4
      sop-common/sop-gateway-common/pom.xml
  19. 4
      sop-common/sop-service-common/pom.xml
  20. 2
      sop-example/pom.xml
  21. 4
      sop-example/sop-springmvc/pom.xml
  22. 4
      sop-example/sop-story/pom.xml
  23. 2
      sop-gateway/pom.xml
  24. 4
      sop-sdk/pom.xml
  25. 4
      sop-sdk/sdk-java/pom.xml
  26. 2
      sop-test/pom.xml
  27. 20
      sop-website/pom.xml
  28. 2
      sop-website/sop-website-server/pom.xml
  29. 5
      sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java

@ -127,7 +127,7 @@ System.out.println(responseData);
- sop-gateway:网关,统一访问入口,含`Spring Cloud Zuul`和`Spring Cloud Gateway`实现 - sop-gateway:网关,统一访问入口,含`Spring Cloud Zuul`和`Spring Cloud Gateway`实现
- sop-example:微服务示例,含springboot,springmvc示例 - sop-example:微服务示例,含springboot,springmvc示例
- sop-website:开放平台对应网站,提供文档API、沙箱测试等内容 - sop-website:开放平台对应网站,提供文档API、沙箱测试等内容
- sop-auth:应用授权服务 - sop-auth:应用授权服务示例
- sop-admin:后台管理 - sop-admin:后台管理
- sop-sdk:基础sdk,含Java、C#版本 - sop-sdk:基础sdk,含Java、C#版本
- sop-test:接口调用测试用例 - sop-test:接口调用测试用例
@ -137,6 +137,7 @@ System.out.println(responseData);
- master:发版分支(当前为4.0版本) - master:发版分支(当前为4.0版本)
- develop:日常开发分支 - develop:日常开发分支
- eureka:使用eureka注册中心 - eureka:使用eureka注册中心
- pr:接受PR的分支,提交PR请提交到此分支
## 相关文档 ## 相关文档

@ -1,5 +1,9 @@
# changelog # changelog
## 4.2.1
- 可指定nacos的group,(`spring.cloud.nacos.discovery.group=xx`)
## 4.2.0 ## 4.2.0
需要执行`sop-upgrade-4.2.0.sql` 需要执行`sop-upgrade-4.2.0.sql`

@ -1,34 +1,34 @@
* [首页](/?t=1595931646391) * [首页](/?t=1606133657136)
* 开发文档 * 开发文档
* [快速体验](files/10010_快速体验.md?t=1595931646394) * [快速体验](files/10010_快速体验.md?t=1606133657138)
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1595931646412) * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1606133657161)
* [新增接口](files/10020_新增接口.md?t=1595931646412) * [新增接口](files/10020_新增接口.md?t=1606133657161)
* [开发流程](files/10021_开发流程.md?t=1595931646412) * [开发流程](files/10021_开发流程.md?t=1606133657161)
* [业务参数校验](files/10030_业务参数校验.md?t=1595931646412) * [业务参数校验](files/10030_业务参数校验.md?t=1606133657161)
* [错误处理](files/10040_错误处理.md?t=1595931646412) * [错误处理](files/10040_错误处理.md?t=1606133657161)
* [编写文档](files/10041_编写文档.md?t=1595931646412) * [编写文档](files/10041_编写文档.md?t=1606133657162)
* [接口交互详解](files/10050_接口交互详解.md?t=1595931646412) * [接口交互详解](files/10050_接口交互详解.md?t=1606133657162)
* [使用签名校验工具](files/10080_使用签名校验工具.md?t=1595931646413) * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1606133657162)
* [ISV管理](files/10085_ISV管理.md?t=1595931646413) * [ISV管理](files/10085_ISV管理.md?t=1606133657162)
* [自定义返回结果](files/10087_自定义返回结果.md?t=1595931646413) * [自定义返回结果](files/10087_自定义返回结果.md?t=1606133657162)
* [自定义过滤器](files/10088_自定义过滤器.md?t=1595931646413) * [自定义过滤器](files/10088_自定义过滤器.md?t=1606133657162)
* [自定义校验token](files/10089_自定义校验token.md?t=1595931646413) * [自定义校验token](files/10089_自定义校验token.md?t=1606133657162)
* [网关拦截器](files/10090_网关拦截器.md?t=1595931646413) * [网关拦截器](files/10090_网关拦截器.md?t=1606133657163)
* [路由授权](files/10090_路由授权.md?t=1595931646413) * [路由授权](files/10091_路由授权.md?t=1606133657163)
* [接口限流](files/10092_接口限流.md?t=1595931646413) * [接口限流](files/10092_接口限流.md?t=1606133657163)
* [路由监控](files/10093_路由监控.md?t=1595931646413) * [路由监控](files/10093_路由监控.md?t=1606133657163)
* [SDK开发](files/10095_SDK开发.md?t=1595931646413) * [SDK开发](files/10095_SDK开发.md?t=1606133657163)
* [应用授权](files/10097_应用授权.md?t=1595931646414) * [应用授权](files/10097_应用授权.md?t=1606133657163)
* [提供restful接口](files/10100_提供restful接口.md?t=1595931646414) * [提供restful接口](files/10100_提供restful接口.md?t=1606133657163)
* [文件上传](files/10104_文件上传.md?t=1595931646414) * [文件上传](files/10104_文件上传.md?t=1606133657163)
* [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1595931646414) * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1606133657164)
* [预发布灰度发布](files/10110_预发布灰度发布.md?t=1595931646414) * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1606133657164)
* [动态修改请求参数](files/10111_动态修改请求参数.md?t=1595931646414) * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1606133657164)
* [使用eureka](files/10112_使用eureka.md?t=1595931646414) * [使用eureka](files/10112_使用eureka.md?t=1606133657164)
* 原理分析 * 原理分析
* [网关性能测试](files/90001_网关性能测试.md?t=1595931646414) * [网关性能测试](files/90001_网关性能测试.md?t=1606133657164)
* [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1595931646415) * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1606133657164)
* [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1595931646415) * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1606133657164)
* [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1595931646415) * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1606133657164)
* [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1595931646415) * [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1606133657165)
* [常见问题](files/90100_常见问题.md?t=1595931646415) * [常见问题](files/90100_常见问题.md?t=1606133657165)

@ -1,103 +1,39 @@
# 自定义过滤器 # 自定义过滤器
## zuul过滤器 演示在网关追加一个header
zuul过滤器列表如下:
| 类型 | 顺序 | 过滤器 | 功能 |
| ----- | ---- | ----------------------- | ---------------------------- |
| pre | -1000 | PreValidateFilter (SOP自带) | 校验签名 |
| pre | -998 | PreLimitFilter (SOP自带) | 限流拦截器 |
| pre | -3 | ServletDetectionFilter | 标记处理 Servlet 的类型 |
| pre | -2 | Servlet30WrapperFilter | 包装 HttpServletRequest 请求 |
| pre | -1 | FormBodyWrapperFilter | 包装请求体 Servlet30WrapperFilter |
| pre | 1 | DebugFilter | 标记调试标志 |
| pre | 5 | PreDecorationFilter | 决定路由转发过滤器 |
| route | 10 | RibbonRoutingFilter | serviceId 请求转发 |
| route | 100 | SimpleHostRoutingFilter | url 请求转发 |
| route | 500 | SendForwardFilter | forward 请求转发 |
| post | 0 | SendErrorFilter | 处理有错误的请求响应 |
| post | 1000 | SendResponseFilter | 处理正常的请求响应 |
顺序值小的优先执行,`-3`之前是sop自带的过滤器,`-3`开始是zuul自带的过滤器。
创建自定义过滤器可以从`-500`开始(-1000 ~ -501留给SOP)。下面是一个自定义过虑器的例子:
```java
public class PreXXXFilter extends BaseZuulFilter {
@Override
protected FilterType getFilterType() {
return FilterType.PRE;
}
@Override
protected int getFilterOrder() {
return -500;
}
@Override
protected Object doRun(RequestContext requestContext) throws ZuulException {
HttpServletRequest request = requestContext.getRequest();
ApiParam apiParam = ZuulContext.getApiParam();
String appKey = apiParam.fetchAppKey();
// ...业务处理
// 固定返回null
return null;
}
}
```
过滤器编写完毕后,在Config中使用:
```java
@Configuration
public class ZuulConfig extends AlipayZuulConfiguration {
...
@Bean
PreXXXFilter preXXXFilter() {
return new PreXXXFilter();
}
...
}
```
## spring cloud gateway
跟zuul同理
```java ```java
public class XXXFilter implements GlobalFilter, Ordered { public class CustomFilter implements GlobalFilter, Ordered {
@Override @Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ApiParam apiParam = (ApiParam)exchange.getAttribute(SopConstants.CACHE_API_PARAM); // 演示在网关追加header
String appKey = apiParam.fetchAppKey(); ApiParam apiParam = ServerWebExchangeUtil.getApiParam(exchange);
// ...业务处理 String token = apiParam.fetchAccessToken();
... ServerWebExchange serverWebExchange = ServerWebExchangeUtil.addHeaders(exchange, httpHeaders -> {
return chain.filter(exchange); httpHeaders.add("token", token);
});
return chain.filter(serverWebExchange);
} }
@Override @Override
public int getOrder() { public int getOrder() {
return -500; // 自定义过滤器可以从0开始
return 0;
} }
} }
``` ```
使用过滤器: 使用过滤器,在sop-gateway中找到MyConfig,添加:
```java ```java
@Configuration @Configuration
public class GatewayConfig extends AlipayGatewayConfiguration { public class MyConfig {
... ...
@Bean @Bean
XXXFilter xxxFilter() { CustomFilter customFilter() {
return new XXXFilter(); return new CustomFilter();
} }
... ...
} }

@ -133,8 +133,8 @@ Transfer/sec: 226.50KB
`restart.sh` `restart.sh`
```bash ```bash
echo "Stopping sop-gateway-4.2.0-SNAPSHOT.jar" echo "Stopping sop-gateway-4.2.1-SNAPSHOT.jar"
pid=`ps -ef | grep sop-gateway-4.2.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'` pid=`ps -ef | grep sop-gateway-4.2.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ] if [ -n "$pid" ]
then then
echo "kill -9 的id:" $pid echo "kill -9 的id:" $pid
@ -142,7 +142,7 @@ then
fi fi
nohup java -jar -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc.log \ nohup java -jar -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc.log \
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8\ -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8\
-XX:+UseConcMarkSweepGC sop-gateway-4.2.0-SNAPSHOT.jar\ -XX:+UseConcMarkSweepGC sop-gateway-4.2.1-SNAPSHOT.jar\
--spring.profiles.active=dev --server.port=8081 & --spring.profiles.active=dev --server.port=8081 &
tail -f nohup.out tail -f nohup.out

@ -1,5 +1,8 @@
# 常见问题 # 常见问题
## Nacos指定group
可在配置文件中添加:`spring.cloud.nacos.discovery.group=xxx`指定group,不加默认是:DEFAULT_GROUP
## 在SpringCloudGateway中获取请求参数 ## 在SpringCloudGateway中获取请求参数

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>doc</artifactId> <artifactId>doc</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<properties> <properties>
<!-- Generic properties --> <!-- Generic properties -->

@ -12,7 +12,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description> <description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description>

@ -6,13 +6,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin</artifactId> <artifactId>sop-admin</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>

@ -5,13 +5,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-admin-server</artifactId> <artifactId>sop-admin-server</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

@ -36,6 +36,9 @@ public class RegistryServiceNacosImpl implements RegistryService {
@Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}") @Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}")
private String nacosNamespace; private String nacosNamespace;
@Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
private String nacosGroup;
private NamingService namingService; private NamingService namingService;
@PostConstruct @PostConstruct
@ -59,7 +62,7 @@ public class RegistryServiceNacosImpl implements RegistryService {
for (String serviceName : serverList) { for (String serviceName : serverList) {
ServiceInfo serviceInfo = new ServiceInfo(); ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setServiceId(serviceName); serviceInfo.setServiceId(serviceName);
List<Instance> instanceList = namingService.getAllInstances(serviceName); List<Instance> instanceList = namingService.getAllInstances(serviceName, nacosGroup);
if (CollectionUtils.isEmpty(instanceList)) { if (CollectionUtils.isEmpty(instanceList)) {
serviceInfo.setInstances(Collections.emptyList()); serviceInfo.setInstances(Collections.emptyList());
} else { } else {

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
@ -25,7 +25,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- sop相关配置 end--> <!-- sop相关配置 end-->
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sdk-java</artifactId> <artifactId>sdk-java</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- http请求 --> <!-- http请求 -->
<dependency> <dependency>

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<artifactId>sop-bridge-eureka</artifactId> <artifactId>sop-bridge-eureka</artifactId>
@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<artifactId>sop-bridge-nacos</artifactId> <artifactId>sop-bridge-nacos</artifactId>
@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -13,6 +13,7 @@ import com.gitee.sop.gatewaycommon.route.ServiceHolder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEvent;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -34,6 +35,9 @@ public class NacosRegistryListener extends BaseRegistryListener {
private volatile Set<NacosServiceHolder> cacheServices = new HashSet<>(); private volatile Set<NacosServiceHolder> cacheServices = new HashSet<>();
@Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
private String nacosGroup;
@Autowired @Autowired
private NacosDiscoveryProperties nacosDiscoveryProperties; private NacosDiscoveryProperties nacosDiscoveryProperties;
@ -95,7 +99,7 @@ public class NacosRegistryListener extends BaseRegistryListener {
List<Instance> allInstances; List<Instance> allInstances;
try { try {
// 获取服务实例 // 获取服务实例
allInstances = namingService.getAllInstances(serviceName); allInstances = namingService.getAllInstances(serviceName, nacosGroup);
} catch (NacosException e) { } catch (NacosException e) {
log.error("namingService.getAllInstances(serviceName)错误,serviceName:{}", serviceName, e); log.error("namingService.getAllInstances(serviceName)错误,serviceName:{}", serviceName, e);
return null; return null;

@ -5,13 +5,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

@ -6,13 +6,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- nacos --> <!-- nacos -->
<dependency> <dependency>

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
@ -19,7 +19,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>

@ -6,13 +6,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-sdk</artifactId> <artifactId>sop-sdk</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>

@ -4,13 +4,13 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sdk-java</artifactId> <artifactId>sdk-java</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<properties> <properties>
<!-- Generic properties --> <!-- Generic properties -->

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>

@ -3,17 +3,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-parent</artifactId> <artifactId>sop-parent</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>sop-website</artifactId> <artifactId>sop-website</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>sop-website-server</module> <module>sop-website-server</module>

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-website</artifactId> <artifactId>sop-website</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository --> <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent> </parent>

@ -29,6 +29,9 @@ public class NacosServerService implements ServerService {
@Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}") @Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}")
private String nacosNamespace; private String nacosNamespace;
@Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
private String nacosGroup;
private NamingService namingService; private NamingService namingService;
@PostConstruct @PostConstruct
@ -49,7 +52,7 @@ public class NacosServerService implements ServerService {
Objects.requireNonNull(serviceId, "serviceId can not be null"); Objects.requireNonNull(serviceId, "serviceId can not be null");
List<String> list = Collections.emptyList(); List<String> list = Collections.emptyList();
try { try {
List<Instance> allInstances = namingService.getAllInstances(serviceId); List<Instance> allInstances = namingService.getAllInstances(serviceId, nacosGroup);
list = allInstances.stream().map(instance -> instance.getIp() + ":" + instance.getPort()) list = allInstances.stream().map(instance -> instance.getIp() + ":" + instance.getPort())
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (NacosException e) { } catch (NacosException e) {

Loading…
Cancel
Save