diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml
index 8411e651..671563ac 100644
--- a/sop-admin/sop-admin-server/pom.xml
+++ b/sop-admin/sop-admin-server/pom.xml
@@ -22,18 +22,20 @@
UTF-8
1.8
3.11.0
+
+ 0.2.3
com.alibaba.boot
nacos-config-spring-boot-starter
- 0.2.3
+ ${nacos-spring-boot-starter.version}
com.alibaba.boot
nacos-discovery-spring-boot-starter
- 0.2.3
+ ${nacos-spring-boot-starter.version}
diff --git a/sop-common/pom.xml b/sop-common/pom.xml
index 974d3664..9028e9a8 100644
--- a/sop-common/pom.xml
+++ b/sop-common/pom.xml
@@ -30,6 +30,7 @@
1.11
2.0.1.Final
6.0.13.Final
+ 0.9.0.RELEASE
@@ -57,14 +58,14 @@
org.springframework.cloud
spring-cloud-alibaba-nacos-discovery
- 0.9.0.RELEASE
+ ${spring-cloud-alibaba-nacos.version}
pom
import
org.springframework.cloud
- spring-cloud-starter-alibaba-nacos-config
- 0.9.0.RELEASE
+ spring-cloud-alibaba-nacos-config
+ ${spring-cloud-alibaba-nacos.version}
pom
import
diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml
index b3170a7c..eff1102b 100644
--- a/sop-common/sop-gateway-common/pom.xml
+++ b/sop-common/sop-gateway-common/pom.xml
@@ -20,14 +20,6 @@
-
- org.springframework.cloud
- spring-cloud-alibaba-nacos-discovery
-
-
- org.springframework.cloud
- spring-cloud-starter-alibaba-nacos-config
-
com.google.guava
guava
@@ -52,6 +44,17 @@
+
+ org.springframework.cloud
+ spring-cloud-alibaba-nacos-discovery
+ true
+
+
+ org.springframework.cloud
+ spring-cloud-alibaba-nacos-config
+ true
+
+
org.springframework.cloud
spring-cloud-starter-netflix-zuul
diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ServiceRoutesLoader.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ServiceRoutesLoader.java
index 8299b5fa..1824af84 100644
--- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ServiceRoutesLoader.java
+++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ServiceRoutesLoader.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gatewaycommon.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
@@ -11,7 +12,6 @@ import com.gitee.sop.gatewaycommon.bean.ServiceRouteInfo;
import com.gitee.sop.gatewaycommon.bean.TargetRoute;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.cloud.alibaba.nacos.NacosDiscoveryProperties;
import org.springframework.context.ApplicationEvent;
import org.springframework.http.HttpStatus;
@@ -41,8 +41,14 @@ public class ServiceRoutesLoader {
@Autowired
private NacosDiscoveryProperties nacosDiscoveryProperties;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+// @NacosInjected
+// private NamingService namingService;
+
+// @Autowired
+// private NacosConfigProperties nacosConfigProperties;
+
+ @NacosInjected
+ private ConfigService configService;
@Autowired
private BaseRouteCache baseRouteCache;
@@ -74,7 +80,7 @@ public class ServiceRoutesLoader {
}
// subscribe
String thisServiceId = nacosDiscoveryProperties.getService();
- ConfigService configService = nacosConfigProperties.configServiceInstance();
+// ConfigService configService = nacosConfigProperties.configServiceInstance();
for (ServiceInfo serviceInfo : subscribes) {
String serviceName = serviceInfo.getName();
// 如果是本机服务,跳过
diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml
index 217bf3d2..3148e0ce 100644
--- a/sop-common/sop-service-common/pom.xml
+++ b/sop-common/sop-service-common/pom.xml
@@ -21,11 +21,14 @@
+
- org.springframework.cloud
- spring-cloud-alibaba-nacos-discovery
+ com.google.guava
+ guava
+ 27.1-jre
+
org.springframework
spring-webmvc
@@ -48,12 +51,11 @@
io.swagger
swagger-annotations
1.5.21
- compile
true
org.springframework.boot
- spring-boot
+ spring-boot-autoconfigure
true
diff --git a/sop-example/sop-book/sop-book-web/pom.xml b/sop-example/sop-book/sop-book-web/pom.xml
index bc38e1d1..f99fc944 100644
--- a/sop-example/sop-book/sop-book-web/pom.xml
+++ b/sop-example/sop-book/sop-book-web/pom.xml
@@ -18,6 +18,10 @@
1.8
2.6.5
Greenwich.RELEASE
+
+ 0.9.0.RELEASE
+
+ 1.1.0
@@ -38,14 +42,6 @@
-
-
-
diff --git a/sop-example/sop-story/sop-story-web/pom.xml b/sop-example/sop-story/sop-story-web/pom.xml
index c6d5365f..44ce5777 100644
--- a/sop-example/sop-story/sop-story-web/pom.xml
+++ b/sop-example/sop-story/sop-story-web/pom.xml
@@ -18,6 +18,10 @@
1.8
2.6.5
Greenwich.RELEASE
+
+ 0.9.0.RELEASE
+
+ 1.1.0
@@ -32,14 +36,6 @@
1.0-SNAPSHOT
-
-
-
@@ -84,12 +73,6 @@
netty-all
-
- com.google.guava
- guava
- 25.1-jre
-
-
io.springfox
diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml
index 6baab2fe..56c8d1e5 100644
--- a/sop-gateway/pom.xml
+++ b/sop-gateway/pom.xml
@@ -17,6 +17,12 @@
1.8
Greenwich.RELEASE
+
+ 0.9.0.RELEASE
+
+ 1.1.0
+
+ 0.2.3
@@ -37,23 +43,6 @@
-
-
-
-
net.oschina.durcframework
fastmybatis-spring-boot-starter
@@ -72,22 +61,25 @@
org.springframework.cloud
spring-cloud-starter-alibaba-nacos-discovery
- 0.2.2.RELEASE
-
-
- com.alibaba.nacos
- nacos-client
-
-
+ ${spring-cloud-alibaba-nacos.version}
com.alibaba.nacos
nacos-client
- 1.1.0
+ ${nacos-client.version}
-
+
+
+ com.alibaba.boot
+ nacos-config-spring-boot-starter
+ ${nacos-spring-boot-starter.version}
+
+
org.springframework.boot
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbEnvGrayManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbEnvGrayManager.java
index f891b303..1927df86 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbEnvGrayManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbEnvGrayManager.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.fastmybatis.core.query.Query;
@@ -17,7 +18,6 @@ import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -49,8 +49,8 @@ public class DbEnvGrayManager extends DefaultEnvGrayManager {
@Autowired
private ConfigGrayInstanceMapper configGrayInstanceMapper;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -100,7 +100,6 @@ public class DbEnvGrayManager extends DefaultEnvGrayManager {
@PostConstruct
protected void after() throws Exception {
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_GRAY, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIPBlacklistManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIPBlacklistManager.java
index c21d639b..542e6f7e 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIPBlacklistManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIPBlacklistManager.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.sop.gateway.mapper.IPBlacklistMapper;
@@ -10,7 +11,6 @@ import com.gitee.sop.gatewaycommon.manager.DefaultIPBlacklistManager;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -28,8 +28,8 @@ public class DbIPBlacklistManager extends DefaultIPBlacklistManager {
@Autowired
private IPBlacklistMapper ipBlacklistMapper;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -41,7 +41,6 @@ public class DbIPBlacklistManager extends DefaultIPBlacklistManager {
@PostConstruct
protected void after() throws Exception {
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_IP_BLACKLIST, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvManager.java
index 048f6c21..f17fefa7 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvManager.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.sop.gateway.entity.IsvDetailDTO;
@@ -13,7 +14,6 @@ import com.gitee.sop.gatewaycommon.secret.CacheIsvManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -29,8 +29,8 @@ public class DbIsvManager extends CacheIsvManager {
@Autowired
private IsvInfoMapper isvInfoMapper;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -47,7 +47,6 @@ public class DbIsvManager extends CacheIsvManager {
protected void after() throws Exception {
ApiConfig.getInstance().setIsvManager(this);
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_ISV, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvRoutePermissionManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvRoutePermissionManager.java
index 1c46fd54..fd61d0c7 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvRoutePermissionManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbIsvRoutePermissionManager.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.fastmybatis.core.query.Query;
@@ -18,7 +19,6 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -54,8 +54,8 @@ public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManage
@Autowired
IsvInfoMapper isvInfoMapper;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -130,7 +130,6 @@ public class DbIsvRoutePermissionManager extends DefaultIsvRoutePermissionManage
@PostConstruct
protected void after() throws Exception {
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_ROUTE_PERMISSION, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbLimitConfigManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbLimitConfigManager.java
index 4e88c94a..34fc168d 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbLimitConfigManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbLimitConfigManager.java
@@ -1,6 +1,7 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.fastmybatis.core.query.Query;
@@ -12,7 +13,6 @@ import com.gitee.sop.gatewaycommon.manager.DefaultLimitConfigManager;
import com.gitee.sop.gatewaycommon.util.MyBeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@@ -32,8 +32,8 @@ public class DbLimitConfigManager extends DefaultLimitConfigManager {
@Autowired
Environment environment;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -53,7 +53,6 @@ public class DbLimitConfigManager extends DefaultLimitConfigManager {
@PostConstruct
protected void after() throws Exception {
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_LIMIT_CONFIG, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbRouteConfigManager.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbRouteConfigManager.java
index bbfe4c08..a96a8493 100644
--- a/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbRouteConfigManager.java
+++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/manager/DbRouteConfigManager.java
@@ -1,21 +1,21 @@
package com.gitee.sop.gateway.manager;
import com.alibaba.fastjson.JSON;
+import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.gitee.fastmybatis.core.query.Query;
import com.gitee.sop.gateway.mapper.ConfigRouteBaseMapper;
import com.gitee.sop.gateway.mapper.ConfigRouteLimitMapper;
import com.gitee.sop.gatewaycommon.bean.ChannelMsg;
-import com.gitee.sop.gatewaycommon.bean.RouteDefinition;
import com.gitee.sop.gatewaycommon.bean.NacosConfigs;
import com.gitee.sop.gatewaycommon.bean.RouteConfig;
+import com.gitee.sop.gatewaycommon.bean.RouteDefinition;
import com.gitee.sop.gatewaycommon.bean.TargetRoute;
import com.gitee.sop.gatewaycommon.manager.DefaultRouteConfigManager;
import com.gitee.sop.gatewaycommon.manager.RouteRepositoryContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@@ -38,8 +38,8 @@ public class DbRouteConfigManager extends DefaultRouteConfigManager {
@Autowired
Environment environment;
- @Autowired
- private NacosConfigProperties nacosConfigProperties;
+ @NacosInjected
+ private ConfigService configService;
@Override
public void load() {
@@ -75,7 +75,6 @@ public class DbRouteConfigManager extends DefaultRouteConfigManager {
@PostConstruct
protected void after() throws Exception {
- ConfigService configService = nacosConfigProperties.configServiceInstance();
configService.addListener(NacosConfigs.DATA_ID_ROUTE_CONFIG, NacosConfigs.GROUP_CHANNEL, new AbstractListener() {
@Override
public void receiveConfigInfo(String configInfo) {
diff --git a/sop-gateway/src/main/resources/application-dev.properties b/sop-gateway/src/main/resources/application-dev.properties
index 9891f433..abd12d2e 100644
--- a/sop-gateway/src/main/resources/application-dev.properties
+++ b/sop-gateway/src/main/resources/application-dev.properties
@@ -36,8 +36,9 @@ ribbon.OkToRetryOnAllOperations=false
# nacos cloud配置
spring.cloud.nacos.discovery.server-addr=${nacos.url}
+nacos.config.server-addr=${nacos.url}
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=${mysql.username}
spring.datasource.password=${mysql.password}
diff --git a/sop-gateway/src/main/resources/bootstrap.properties b/sop-gateway/src/main/resources/bootstrap.properties
deleted file mode 100644
index 9af67138..00000000
--- a/sop-gateway/src/main/resources/bootstrap.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-spring.application.name=api-gateway
-# nacos的config需要放在bootstrap.properties中
-spring.cloud.nacos.config.server-addr=127.0.0.1:8848
\ No newline at end of file