diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md index a6b48b7e..d510aa50 100644 --- a/doc/docs/_sidebar.md +++ b/doc/docs/_sidebar.md @@ -1,39 +1,39 @@ -* [首页](/?t=1591927043815) +* [首页](/?t=1595832340981) * 开发文档 - * [快速体验](files/10010_快速体验.md?t=1591927043817) - * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1591927043835) - * [新增接口](files/10020_新增接口.md?t=1591927043836) - * [开发流程](files/10021_开发流程.md?t=1591927043836) - * [业务参数校验](files/10030_业务参数校验.md?t=1591927043836) - * [错误处理](files/10040_错误处理.md?t=1591927043836) - * [编写文档](files/10041_编写文档.md?t=1591927043836) - * [接口交互详解](files/10050_接口交互详解.md?t=1591927043836) - * [easyopen支持](files/10070_easyopen支持.md?t=1591927043836) - * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1591927043836) - * [ISV管理](files/10085_ISV管理.md?t=1591927043836) - * [自定义返回结果](files/10087_自定义返回结果.md?t=1591927043837) - * [自定义过滤器](files/10088_自定义过滤器.md?t=1591927043837) - * [自定义校验token](files/10089_自定义校验token.md?t=1591927043837) - * [网关拦截器](files/10090_网关拦截器.md?t=1591927043837) - * [路由授权](files/10090_路由授权.md?t=1591927043837) - * [接口限流](files/10092_接口限流.md?t=1591927043837) - * [路由监控](files/10093_路由监控.md?t=1591927043837) - * [SDK开发](files/10095_SDK开发.md?t=1591927043837) - * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1591927043837) - * [应用授权](files/10097_应用授权.md?t=1591927043837) - * [提供restful接口](files/10100_提供restful接口.md?t=1591927043838) - * [文件上传](files/10104_文件上传.md?t=1591927043838) - * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1591927043838) - * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1591927043838) - * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1591927043838) - * [使用eureka](files/10112_使用eureka.md?t=1591927043838) - * [扩展其它注册中心](files/10113_扩展其它注册中心.md?t=1591927043838) + * [快速体验](files/10010_快速体验.md?t=1595832340983) + * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1595832341000) + * [新增接口](files/10020_新增接口.md?t=1595832341000) + * [开发流程](files/10021_开发流程.md?t=1595832341001) + * [业务参数校验](files/10030_业务参数校验.md?t=1595832341001) + * [错误处理](files/10040_错误处理.md?t=1595832341001) + * [编写文档](files/10041_编写文档.md?t=1595832341001) + * [接口交互详解](files/10050_接口交互详解.md?t=1595832341001) + * [easyopen支持](files/10070_easyopen支持.md?t=1595832341001) + * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1595832341001) + * [ISV管理](files/10085_ISV管理.md?t=1595832341001) + * [自定义返回结果](files/10087_自定义返回结果.md?t=1595832341001) + * [自定义过滤器](files/10088_自定义过滤器.md?t=1595832341001) + * [自定义校验token](files/10089_自定义校验token.md?t=1595832341002) + * [网关拦截器](files/10090_网关拦截器.md?t=1595832341002) + * [路由授权](files/10090_路由授权.md?t=1595832341002) + * [接口限流](files/10092_接口限流.md?t=1595832341002) + * [路由监控](files/10093_路由监控.md?t=1595832341002) + * [SDK开发](files/10095_SDK开发.md?t=1595832341002) + * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1595832341002) + * [应用授权](files/10097_应用授权.md?t=1595832341003) + * [提供restful接口](files/10100_提供restful接口.md?t=1595832341003) + * [文件上传](files/10104_文件上传.md?t=1595832341003) + * [配置Sleuth链路追踪](files/10109_配置Sleuth链路追踪.md?t=1595832341003) + * [预发布灰度发布](files/10110_预发布灰度发布.md?t=1595832341003) + * [动态修改请求参数](files/10111_动态修改请求参数.md?t=1595832341003) + * [使用eureka](files/10112_使用eureka.md?t=1595832341003) + * [扩展其它注册中心](files/10113_扩展其它注册中心.md?t=1595832341003) * 原理分析 - * [网关性能测试](files/90001_网关性能测试.md?t=1591927043838) - * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1591927043838) - * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1591927043838) - * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1591927043839) - * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1591927043839) - * [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1591927043839) - * [2.x升3.x注意事项](files/90099_2.x升3.x注意事项.md?t=1591927043839) - * [常见问题](files/90100_常见问题.md?t=1591927043839) + * [网关性能测试](files/90001_网关性能测试.md?t=1595832341004) + * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1595832341004) + * [原理分析之如何存储路由](files/90011_原理分析之如何存储路由.md?t=1595832341004) + * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1595832341004) + * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1595832341004) + * [原理分析之预发布灰度发布](files/90014_原理分析之预发布灰度发布.md?t=1595832341004) + * [2.x升3.x注意事项](files/90099_2.x升3.x注意事项.md?t=1595832341004) + * [常见问题](files/90100_常见问题.md?t=1595832341004) diff --git a/doc/docs/files/10011_项目接入到SOP.md b/doc/docs/files/10011_项目接入到SOP.md index b0e6af8b..7cadcae9 100644 --- a/doc/docs/files/10011_项目接入到SOP.md +++ b/doc/docs/files/10011_项目接入到SOP.md @@ -6,11 +6,13 @@ ```xml - Greenwich.RELEASE - - 0.9.0.RELEASE - - 1.1.3 + + 2.2.5.RELEASE + + Hoxton.SR3 + + + 2.2.1.RELEASE ``` @@ -19,10 +21,24 @@ ```xml + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + org.springframework.cloud spring-cloud-dependencies - Greenwich.RELEASE + ${spring-cloud.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring-cloud-alibaba.version} pom import @@ -40,28 +56,16 @@ 最新版本 - - org.springframework.cloud + com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery - ${spring-cloud-alibaba-nacos.version} - - - com.alibaba.nacos - nacos-client - ${nacos-client.version} - ``` - application.properties配置文件添加 ```properties server.port=2222 -# 服务名称 spring.application.name=story-service # nacos注册中心 spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/SopAdminServerApplication.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/SopAdminServerApplication.java index 52bf77ac..e388660d 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/SopAdminServerApplication.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/SopAdminServerApplication.java @@ -2,9 +2,7 @@ package com.gitee.sop.adminserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -@EnableDiscoveryClient @SpringBootApplication public class SopAdminServerApplication { diff --git a/sop-admin/sop-admin-server/src/main/resources/META-INF/sop-admin.properties b/sop-admin/sop-admin-server/src/main/resources/META-INF/sop-admin.properties index a98965a0..f182a180 100644 --- a/sop-admin/sop-admin-server/src/main/resources/META-INF/sop-admin.properties +++ b/sop-admin/sop-admin-server/src/main/resources/META-INF/sop-admin.properties @@ -12,6 +12,8 @@ sop.sign-type=rsa # nacos配置 nacos.config.server-addr=${nacos.url} nacos.discovery.server-addr=${nacos.url} +# nacos cloud配置 +spring.cloud.nacos.discovery.server-addr=${nacos.url} # 数据库配置 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java index 3f19bddb..b1aceee3 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java @@ -32,9 +32,9 @@ import static java.util.Collections.synchronizedMap; @Slf4j public class GatewayRouteRepository implements RouteRepository, RouteLocator { - private PathMatcher pathMatcher = new AntPathMatcher(); + private final PathMatcher pathMatcher = new AntPathMatcher(); - private final Map routes = synchronizedMap(new LinkedHashMap<>()); + private static final Map routes = synchronizedMap(new LinkedHashMap<>()); @Autowired private RouteLocatorBuilder routeLocatorBuilder; @@ -54,7 +54,7 @@ public class GatewayRouteRepository implements RouteRepository routeDefinitionList = this.routes.values() + List routeDefinitionList = routes.values() .stream() .map(AbstractTargetRoute::getRouteDefinition) .collect(Collectors.toList()); @@ -135,7 +135,7 @@ public class GatewayRouteRepository implements RouteRepository idList = this.routes.values().stream() + List idList = routes.values().stream() .filter(zuulTargetRoute -> StringUtils.equalsIgnoreCase(serviceId, zuulTargetRoute.getServiceRouteInfo().getServiceId())) .map(zuulTargetRoute -> zuulTargetRoute.getRouteDefinition().getId()) .collect(Collectors.toList()); diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java index e25f5aac..632cdb83 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java @@ -18,12 +18,12 @@ import java.util.stream.Collectors; */ public class ZuulRouteRepository implements RouteRepository { - private PathMatcher pathMatcher = new AntPathMatcher(); + private final PathMatcher pathMatcher = new AntPathMatcher(); /** * key:nameVersion */ - private Map nameVersionTargetRouteMap = new ConcurrentHashMap<>(128); + private static final Map nameVersionTargetRouteMap = new ConcurrentHashMap<>(128); @Override public ZuulTargetRoute get(String id) {