diff --git a/changelog.md b/changelog.md
index 264e3c1c..a8111c01 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
# changelog
+## 4.2.1
+
+- 可指定nacos的group,(`spring.cloud.nacos.discovery.group=xx`)
+
## 4.2.0
需要执行`sop-upgrade-4.2.0.sql`
diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md
index 141cf17c..c3b62b4b 100644
--- a/doc/docs/_sidebar.md
+++ b/doc/docs/_sidebar.md
@@ -1,34 +1,34 @@
-* [首页](/?t=1605839305335)
+* [首页](/?t=1606133657136)
* 开发文档
- * [快速体验](files/10010_快速体验.md?t=1605839305338)
- * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1605839305366)
- * [新增接口](files/10020_新增接口.md?t=1605839305366)
- * [开发流程](files/10021_开发流程.md?t=1605839305367)
- * [业务参数校验](files/10030_业务参数校验.md?t=1605839305367)
- * [错误处理](files/10040_错误处理.md?t=1605839305367)
- * [编写文档](files/10041_编写文档.md?t=1605839305367)
- * [接口交互详解](files/10050_接口交互详解.md?t=1605839305367)
- * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1605839305367)
- * [ISV管理](files/10085_ISV管理.md?t=1605839305367)
- * [自定义返回结果](files/10087_自定义返回结果.md?t=1605839305368)
- * [自定义过滤器](files/10088_自定义过滤器.md?t=1605839305368)
- * [自定义校验token](files/10089_自定义校验token.md?t=1605839305368)
- * [网关拦截器](files/10090_网关拦截器.md?t=1605839305368)
- * [路由授权](files/10090_路由授权.md?t=1605839305368)
- * [接口限流](files/10092_接口限流.md?t=1605839305368)
- * [路由监控](files/10093_路由监控.md?t=1605839305369)
- * [SDK开发](files/10095_SDK开发.md?t=1605839305369)
- * [应用授权](files/10097_应用授权.md?t=1605839305369)
- * [提供restful接口](files/10100_提供restful接口.md?t=1605839305369)
- * [文件上传](files/10104_文件上传.md?t=1605839305370)
- * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1605839305370)
- * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1605839305370)
- * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1605839305370)
- * [使用eureka](files/10112_使用eureka.md?t=1605839305370)
+ * [快速体验](files/10010_快速体验.md?t=1606133657138)
+ * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1606133657161)
+ * [新增接口](files/10020_新增接口.md?t=1606133657161)
+ * [开发流程](files/10021_开发流程.md?t=1606133657161)
+ * [业务参数校验](files/10030_业务参数校验.md?t=1606133657161)
+ * [错误处理](files/10040_错误处理.md?t=1606133657161)
+ * [编写文档](files/10041_编写文档.md?t=1606133657162)
+ * [接口交互详解](files/10050_接口交互详解.md?t=1606133657162)
+ * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1606133657162)
+ * [ISV管理](files/10085_ISV管理.md?t=1606133657162)
+ * [自定义返回结果](files/10087_自定义返回结果.md?t=1606133657162)
+ * [自定义过滤器](files/10088_自定义过滤器.md?t=1606133657162)
+ * [自定义校验token](files/10089_自定义校验token.md?t=1606133657162)
+ * [网关拦截器](files/10090_网关拦截器.md?t=1606133657163)
+ * [路由授权](files/10091_路由授权.md?t=1606133657163)
+ * [接口限流](files/10092_接口限流.md?t=1606133657163)
+ * [路由监控](files/10093_路由监控.md?t=1606133657163)
+ * [SDK开发](files/10095_SDK开发.md?t=1606133657163)
+ * [应用授权](files/10097_应用授权.md?t=1606133657163)
+ * [提供restful接口](files/10100_提供restful接口.md?t=1606133657163)
+ * [文件上传](files/10104_文件上传.md?t=1606133657163)
+ * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1606133657164)
+ * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1606133657164)
+ * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1606133657164)
+ * [使用eureka](files/10112_使用eureka.md?t=1606133657164)
* 原理分析
- * [网关性能测试](files/90001_网关性能测试.md?t=1605839305371)
- * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1605839305371)
- * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1605839305371)
- * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1605839305371)
- * [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1605839305371)
- * [常见问题](files/90100_常见问题.md?t=1605839305372)
+ * [网关性能测试](files/90001_网关性能测试.md?t=1606133657164)
+ * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1606133657164)
+ * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1606133657164)
+ * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1606133657164)
+ * [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1606133657165)
+ * [常见问题](files/90100_常见问题.md?t=1606133657165)
diff --git a/doc/docs/files/10090_路由授权.md b/doc/docs/files/10091_路由授权.md
similarity index 100%
rename from doc/docs/files/10090_路由授权.md
rename to doc/docs/files/10091_路由授权.md
diff --git a/doc/docs/files/90001_网关性能测试.md b/doc/docs/files/90001_网关性能测试.md
index d74fd3fd..d005a802 100644
--- a/doc/docs/files/90001_网关性能测试.md
+++ b/doc/docs/files/90001_网关性能测试.md
@@ -133,8 +133,8 @@ Transfer/sec: 226.50KB
`restart.sh`
```bash
-echo "Stopping sop-gateway-4.2.0-SNAPSHOT.jar"
-pid=`ps -ef | grep sop-gateway-4.2.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
+echo "Stopping sop-gateway-4.2.1-SNAPSHOT.jar"
+pid=`ps -ef | grep sop-gateway-4.2.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
echo "kill -9 的id:" $pid
@@ -142,7 +142,7 @@ then
fi
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:+UseConcMarkSweepGC sop-gateway-4.2.0-SNAPSHOT.jar\
+ -XX:+UseConcMarkSweepGC sop-gateway-4.2.1-SNAPSHOT.jar\
--spring.profiles.active=dev --server.port=8081 &
tail -f nohup.out
diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md
index 0995c8a4..940c85d8 100644
--- a/doc/docs/files/90100_常见问题.md
+++ b/doc/docs/files/90100_常见问题.md
@@ -1,5 +1,8 @@
# 常见问题
+## Nacos指定group
+
+可在配置文件中添加:`spring.cloud.nacos.discovery.group=xxx`指定group,不加默认是:DEFAULT_GROUP
## 在SpringCloudGateway中获取请求参数
diff --git a/doc/pom.xml b/doc/pom.xml
index 249ed1ba..0e490c84 100644
--- a/doc/pom.xml
+++ b/doc/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.gitee.sop
doc
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index 6b638bea..0ad752ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
4.0.0
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
pom
一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台
diff --git a/sop-admin/pom.xml b/sop-admin/pom.xml
index de967634..caacc7dd 100644
--- a/sop-admin/pom.xml
+++ b/sop-admin/pom.xml
@@ -6,13 +6,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
4.0.0
sop-admin
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
pom
diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml
index ac5f2e55..97f39640 100644
--- a/sop-admin/sop-admin-server/pom.xml
+++ b/sop-admin/sop-admin-server/pom.xml
@@ -5,13 +5,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
sop-admin-server
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
jar
diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/impl/RegistryServiceNacosImpl.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/impl/RegistryServiceNacosImpl.java
index 3e7e123d..0e9ace78 100644
--- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/impl/RegistryServiceNacosImpl.java
+++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/impl/RegistryServiceNacosImpl.java
@@ -36,6 +36,9 @@ public class RegistryServiceNacosImpl implements RegistryService {
@Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}")
private String nacosNamespace;
+ @Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
+ private String nacosGroup;
+
private NamingService namingService;
@PostConstruct
@@ -59,7 +62,7 @@ public class RegistryServiceNacosImpl implements RegistryService {
for (String serviceName : serverList) {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setServiceId(serviceName);
- List instanceList = namingService.getAllInstances(serviceName);
+ List instanceList = namingService.getAllInstances(serviceName, nacosGroup);
if (CollectionUtils.isEmpty(instanceList)) {
serviceInfo.setInstances(Collections.emptyList());
} else {
diff --git a/sop-auth/pom.xml b/sop-auth/pom.xml
index 2ba963cc..a9ce6b58 100644
--- a/sop-auth/pom.xml
+++ b/sop-auth/pom.xml
@@ -5,7 +5,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
@@ -25,7 +25,7 @@
com.gitee.sop
sop-service-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
@@ -38,7 +38,7 @@
com.gitee.sop
sdk-java
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-common/pom.xml b/sop-common/pom.xml
index 54f01ea5..b47d704a 100644
--- a/sop-common/pom.xml
+++ b/sop-common/pom.xml
@@ -6,7 +6,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
diff --git a/sop-common/sop-bridge-eureka/pom.xml b/sop-common/sop-bridge-eureka/pom.xml
index 5cef86a7..30da75c1 100644
--- a/sop-common/sop-bridge-eureka/pom.xml
+++ b/sop-common/sop-bridge-eureka/pom.xml
@@ -5,12 +5,12 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
sop-bridge-eureka
@@ -18,7 +18,7 @@
com.gitee.sop
sop-gateway-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-common/sop-bridge-nacos/pom.xml b/sop-common/sop-bridge-nacos/pom.xml
index 010d518d..7e8a4e74 100644
--- a/sop-common/sop-bridge-nacos/pom.xml
+++ b/sop-common/sop-bridge-nacos/pom.xml
@@ -5,12 +5,12 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
sop-bridge-nacos
@@ -18,7 +18,7 @@
com.gitee.sop
sop-gateway-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-common/sop-bridge-nacos/src/main/java/com/gitee/sop/bridge/route/NacosRegistryListener.java b/sop-common/sop-bridge-nacos/src/main/java/com/gitee/sop/bridge/route/NacosRegistryListener.java
index 48058ad4..84f6e4fb 100644
--- a/sop-common/sop-bridge-nacos/src/main/java/com/gitee/sop/bridge/route/NacosRegistryListener.java
+++ b/sop-common/sop-bridge-nacos/src/main/java/com/gitee/sop/bridge/route/NacosRegistryListener.java
@@ -13,6 +13,7 @@ import com.gitee.sop.gatewaycommon.route.ServiceHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEvent;
import org.springframework.util.CollectionUtils;
@@ -34,6 +35,9 @@ public class NacosRegistryListener extends BaseRegistryListener {
private volatile Set cacheServices = new HashSet<>();
+ @Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
+ private String nacosGroup;
+
@Autowired
private NacosDiscoveryProperties nacosDiscoveryProperties;
@@ -95,7 +99,7 @@ public class NacosRegistryListener extends BaseRegistryListener {
List allInstances;
try {
// 获取服务实例
- allInstances = namingService.getAllInstances(serviceName);
+ allInstances = namingService.getAllInstances(serviceName, nacosGroup);
} catch (NacosException e) {
log.error("namingService.getAllInstances(serviceName)错误,serviceName:{}", serviceName, e);
return null;
diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml
index db68858f..a3b7b0cc 100644
--- a/sop-common/sop-gateway-common/pom.xml
+++ b/sop-common/sop-gateway-common/pom.xml
@@ -5,13 +5,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
sop-gateway-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
jar
diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml
index 25523f50..f8186814 100644
--- a/sop-common/sop-service-common/pom.xml
+++ b/sop-common/sop-service-common/pom.xml
@@ -6,13 +6,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
sop-service-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
jar
diff --git a/sop-example/pom.xml b/sop-example/pom.xml
index 97c868ff..0586602d 100644
--- a/sop-example/pom.xml
+++ b/sop-example/pom.xml
@@ -5,7 +5,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
diff --git a/sop-example/sop-springmvc/pom.xml b/sop-example/sop-springmvc/pom.xml
index 2a13e736..fe0cda9e 100644
--- a/sop-example/sop-springmvc/pom.xml
+++ b/sop-example/sop-springmvc/pom.xml
@@ -5,7 +5,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
@@ -26,7 +26,7 @@
com.gitee.sop
sop-service-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-example/sop-story/pom.xml b/sop-example/sop-story/pom.xml
index a4d74f39..eae1cf39 100644
--- a/sop-example/sop-story/pom.xml
+++ b/sop-example/sop-story/pom.xml
@@ -4,7 +4,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
@@ -19,7 +19,7 @@
com.gitee.sop
sop-service-common
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml
index 9bde7307..a23a0861 100644
--- a/sop-gateway/pom.xml
+++ b/sop-gateway/pom.xml
@@ -4,7 +4,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
@@ -24,7 +24,7 @@
com.gitee.sop
sop-bridge-nacos
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-sdk/pom.xml b/sop-sdk/pom.xml
index b9d68e7c..ae6a809c 100644
--- a/sop-sdk/pom.xml
+++ b/sop-sdk/pom.xml
@@ -6,13 +6,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
4.0.0
sop-sdk
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
pom
diff --git a/sop-sdk/sdk-java/pom.xml b/sop-sdk/sdk-java/pom.xml
index 130ac0cf..0eb739d6 100644
--- a/sop-sdk/sdk-java/pom.xml
+++ b/sop-sdk/sdk-java/pom.xml
@@ -4,13 +4,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../../pom.xml
4.0.0
sdk-java
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-test/pom.xml b/sop-test/pom.xml
index 9682e0a4..7708e12c 100644
--- a/sop-test/pom.xml
+++ b/sop-test/pom.xml
@@ -5,7 +5,7 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
diff --git a/sop-website/pom.xml b/sop-website/pom.xml
index f06573cd..a4629f36 100644
--- a/sop-website/pom.xml
+++ b/sop-website/pom.xml
@@ -6,13 +6,13 @@
com.gitee.sop
sop-parent
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
4.0.0
sop-website
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
pom
diff --git a/sop-website/sop-website-server/pom.xml b/sop-website/sop-website-server/pom.xml
index b691b8d0..c9b15852 100644
--- a/sop-website/sop-website-server/pom.xml
+++ b/sop-website/sop-website-server/pom.xml
@@ -5,7 +5,7 @@
com.gitee.sop
sop-website
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
../pom.xml
@@ -25,7 +25,7 @@
com.gitee.sop
sop-bridge-nacos
- 4.2.0-SNAPSHOT
+ 4.2.1-SNAPSHOT
diff --git a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java
index 6d1bd69f..585dc988 100644
--- a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java
+++ b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java
@@ -29,6 +29,9 @@ public class NacosServerService implements ServerService {
@Value("${nacos.discovery.namespace:${spring.cloud.nacos.discovery.namespace:}}")
private String nacosNamespace;
+ @Value("${nacos.discovery.group:${spring.cloud.nacos.discovery.group:DEFAULT_GROUP}}")
+ private String nacosGroup;
+
private NamingService namingService;
@PostConstruct
@@ -49,7 +52,7 @@ public class NacosServerService implements ServerService {
Objects.requireNonNull(serviceId, "serviceId can not be null");
List list = Collections.emptyList();
try {
- List allInstances = namingService.getAllInstances(serviceId);
+ List allInstances = namingService.getAllInstances(serviceId, nacosGroup);
list = allInstances.stream().map(instance -> instance.getIp() + ":" + instance.getPort())
.collect(Collectors.toList());
} catch (NacosException e) {