diff --git a/changelog.md b/changelog.md index 69a2dd87..ca11c3c8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # changelog +## 4.3.1 + +- 修复serviceId有大小写出现404问题 + ## 4.3.0 - 升级`spring-boot/spring-cloud/spring-cloud-alibaba`版本 diff --git a/doc/docs/files/10011_项目接入到SOP.md b/doc/docs/files/10011_项目接入到SOP.md index 324e80f5..e1138abc 100644 --- a/doc/docs/files/10011_项目接入到SOP.md +++ b/doc/docs/files/10011_项目接入到SOP.md @@ -6,13 +6,12 @@ ```xml -2.1.8.RELEASE +2.3.2.RELEASE -Greenwich.SR6 +Hoxton.SR8 -2.1.2.RELEASE - +2.2.5.RELEASE ``` - pom.xml添加``控制版本 @@ -94,6 +93,8 @@ public class OpenServiceConfig extends AlipayServiceConfiguration { php应用提供的接口需要返回如下json内容: +假设请求的接口为:`http://open.xxx.com/get_routes` + ```json { "serviceId": "goods-service", @@ -158,7 +159,7 @@ instance.setServiceName("goods-service"); instance.setIp("192.168.0.11"); instance.setPort(8080); // 在nacos的metadata中指定接口路径 -instance.getMetadata().put("sop.routes.path", "/goods/list_goods"); +instance.getMetadata().put("sop.routes.path", "http://open.xxx.com/get_routes"); namingService.registerInstance(serviceId, instance); ``` diff --git a/doc/pom.xml b/doc/pom.xml index 390a58bb..6e5c1f3c 100644 --- a/doc/pom.xml +++ b/doc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.gitee.sop doc - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 6fd51c7d..0a470e78 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ 4.0.0 com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT pom 一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台 diff --git a/sop-admin/pom.xml b/sop-admin/pom.xml index 94f7a905..fa9d4283 100644 --- a/sop-admin/pom.xml +++ b/sop-admin/pom.xml @@ -6,7 +6,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml index e517a61c..61f81fc9 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.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../../pom.xml 4.0.0 sop-admin-server - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT jar diff --git a/sop-auth/pom.xml b/sop-auth/pom.xml index 5995331e..54dff092 100644 --- a/sop-auth/pom.xml +++ b/sop-auth/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml @@ -37,7 +37,7 @@ com.gitee.sop sdk-java - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT diff --git a/sop-common/pom.xml b/sop-common/pom.xml index 5e6dd298..a986fd84 100644 --- a/sop-common/pom.xml +++ b/sop-common/pom.xml @@ -6,7 +6,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-common/sop-bridge-eureka/pom.xml b/sop-common/sop-bridge-eureka/pom.xml index 10384c7b..32e614b4 100644 --- a/sop-common/sop-bridge-eureka/pom.xml +++ b/sop-common/sop-bridge-eureka/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-common - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/sop-common/sop-bridge-nacos/pom.xml b/sop-common/sop-bridge-nacos/pom.xml index b835dc56..f5f3d991 100644 --- a/sop-common/sop-bridge-nacos/pom.xml +++ b/sop-common/sop-bridge-nacos/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-common - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml index ed9c6954..e83fd8ec 100644 --- a/sop-common/sop-gateway-common/pom.xml +++ b/sop-common/sop-gateway-common/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-common - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java index 68a1f07f..c029a1cc 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/route/ServiceRouteListener.java @@ -45,13 +45,25 @@ public class ServiceRouteListener extends BaseServiceListener { ResponseEntity responseEntity = getRestTemplate().getForEntity(url, String.class); if (responseEntity.getStatusCode() == HttpStatus.OK) { String body = responseEntity.getBody(); - ServiceRouteInfo serviceRouteInfo = JSON.parseObject(body, ServiceRouteInfo.class); + ServiceRouteInfo serviceRouteInfo; + try { + serviceRouteInfo = this.parseServiceRouteInfo(body); + } catch (Exception e) { + log.error("解析路由配置错误,body:{}", body, e); + return; + } gatewayRouteCache.load(serviceRouteInfo, callback -> routesProcessor.saveRoutes(serviceRouteInfo, instance)); } else { log.error("拉取路由配置异常,url: {}, status: {}, body: {}", url, responseEntity.getStatusCodeValue(), responseEntity.getBody()); } } + private ServiceRouteInfo parseServiceRouteInfo(String body) { + ServiceRouteInfo serviceRouteInfo = JSON.parseObject(body, ServiceRouteInfo.class); + serviceRouteInfo.setServiceId(serviceRouteInfo.getServiceId().toLowerCase()); + return serviceRouteInfo; + } + protected HttpEntity getHttpEntity() { HttpHeaders headers = new HttpHeaders(); return new HttpEntity<>(headers); diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml index f9e1457d..b1441d0a 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-common - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml 4.0.0 sop-service-common - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT jar diff --git a/sop-example/pom.xml b/sop-example/pom.xml index 16e3096a..a9a58aef 100644 --- a/sop-example/pom.xml +++ b/sop-example/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-example/sop-springmvc/pom.xml b/sop-example/sop-springmvc/pom.xml index ded61da7..bc94f4eb 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.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../../pom.xml diff --git a/sop-example/sop-story/pom.xml b/sop-example/sop-story/pom.xml index 0075e7f2..081e5bec 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.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../../pom.xml diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index 80df50f2..b59ac9c9 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -4,7 +4,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-sdk/pom.xml b/sop-sdk/pom.xml index db712537..bebee007 100644 --- a/sop-sdk/pom.xml +++ b/sop-sdk/pom.xml @@ -6,7 +6,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-sdk/sdk-java/pom.xml b/sop-sdk/sdk-java/pom.xml index 5ab7a493..924b9f76 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.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../../pom.xml 4.0.0 sdk-java - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT diff --git a/sop-test/pom.xml b/sop-test/pom.xml index 49510e22..f4aa0153 100644 --- a/sop-test/pom.xml +++ b/sop-test/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-website/pom.xml b/sop-website/pom.xml index 8c2bea82..833b14c6 100644 --- a/sop-website/pom.xml +++ b/sop-website/pom.xml @@ -6,7 +6,7 @@ com.gitee.sop sop-parent - 4.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml diff --git a/sop-website/sop-website-server/pom.xml b/sop-website/sop-website-server/pom.xml index 02629b1a..8de75acb 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.3.0-SNAPSHOT + 4.3.1-SNAPSHOT ../pom.xml