Merge branch 'master' into eureka

# Conflicts:
#	sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java
#	sop-example/sop-story/src/main/resources/application-dev.properties
eureka
tanghc 4 years ago
commit 8b729c28d6
  1. 74
      doc/docs/_sidebar.md
  2. 42
      doc/docs/files/10011_项目接入到SOP.md
  3. 2
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/SopAdminServerApplication.java
  4. 2
      sop-admin/sop-admin-server/src/main/resources/META-INF/sop-admin.properties
  5. 8
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java
  6. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/ZuulRouteRepository.java

@ -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)

@ -6,11 +6,13 @@
```xml
<properties>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
<!-- nacos spring cloud版本号 -->
<spring-cloud-alibaba-nacos.version>0.9.0.RELEASE</spring-cloud-alibaba-nacos.version>
<!-- nacos客户端版本号 -->
<nacos-client.version>1.1.3</nacos-client.version>
<!-- springboot 版本-->
<spring-boot.version>2.2.5.RELEASE</spring-boot.version>
<!-- spring cloud 版本 -->
<spring-cloud.version>Hoxton.SR3</spring-cloud.version>
<!-- spring cloud alibaba 版本 -->
<!-- 具体版本对应关系见:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E -->
<spring-cloud-alibaba.version>2.2.1.RELEASE</spring-cloud-alibaba.version>
</properties>
```
@ -19,10 +21,24 @@
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -40,28 +56,16 @@
<version>最新版本</version>
</dependency>
<!-- 使用nacos注册中心
版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本。
https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-alibaba-nacos-discovery
-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>${spring-cloud-alibaba-nacos.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${nacos-client.version}</version>
</dependency>
<!-- 注册中心end -->
```
- application.properties配置文件添加
```properties
server.port=2222
# 服务名称
spring.application.name=story-service
# nacos注册中心
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848

@ -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 {

@ -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

@ -32,9 +32,9 @@ import static java.util.Collections.synchronizedMap;
@Slf4j
public class GatewayRouteRepository implements RouteRepository<GatewayTargetRoute>, RouteLocator {
private PathMatcher pathMatcher = new AntPathMatcher();
private final PathMatcher pathMatcher = new AntPathMatcher();
private final Map<String, GatewayTargetRoute> routes = synchronizedMap(new LinkedHashMap<>());
private static final Map<String, GatewayTargetRoute> routes = synchronizedMap(new LinkedHashMap<>());
@Autowired
private RouteLocatorBuilder routeLocatorBuilder;
@ -54,7 +54,7 @@ public class GatewayRouteRepository implements RouteRepository<GatewayTargetRout
public void refresh() {
RouteLocatorBuilder.Builder builder = routeLocatorBuilder.routes();
List<RouteDefinition> routeDefinitionList = this.routes.values()
List<RouteDefinition> routeDefinitionList = routes.values()
.stream()
.map(AbstractTargetRoute::getRouteDefinition)
.collect(Collectors.toList());
@ -135,7 +135,7 @@ public class GatewayRouteRepository implements RouteRepository<GatewayTargetRout
@Override
public void deleteAll(String serviceId) {
List<String> idList = this.routes.values().stream()
List<String> idList = routes.values().stream()
.filter(zuulTargetRoute -> StringUtils.equalsIgnoreCase(serviceId, zuulTargetRoute.getServiceRouteInfo().getServiceId()))
.map(zuulTargetRoute -> zuulTargetRoute.getRouteDefinition().getId())
.collect(Collectors.toList());

@ -18,12 +18,12 @@ import java.util.stream.Collectors;
*/
public class ZuulRouteRepository implements RouteRepository<ZuulTargetRoute> {
private PathMatcher pathMatcher = new AntPathMatcher();
private final PathMatcher pathMatcher = new AntPathMatcher();
/**
* keynameVersion
*/
private Map<String, ZuulTargetRoute> nameVersionTargetRouteMap = new ConcurrentHashMap<>(128);
private static final Map<String, ZuulTargetRoute> nameVersionTargetRouteMap = new ConcurrentHashMap<>(128);
@Override
public ZuulTargetRoute get(String id) {

Loading…
Cancel
Save