diff --git a/CHANGELOG.md b/CHANGELOG.md index 832a2e245..e8cd442e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,4 @@ - [fix:fix javadoc.](https://github.com/Tencent/spring-cloud-tencent/pull/726) - [fix:fix discovery junit.](https://github.com/Tencent/spring-cloud-tencent/pull/728) - [adapt polaris-java 1.10.1 version](https://github.com/Tencent/spring-cloud-tencent/pull/748) +- [Optimize: change RouteArgument.buildCustom to RouteArgument.fromLabel](https://github.com/Tencent/spring-cloud-tencent/pull/750) diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/MetadataRouterRequestInterceptor.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/MetadataRouterRequestInterceptor.java index 5a29a1ff9..e8de0fa29 100644 --- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/MetadataRouterRequestInterceptor.java +++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/MetadataRouterRequestInterceptor.java @@ -60,7 +60,7 @@ public class MetadataRouterRequestInterceptor implements RouterRequestIntercepto Set routeArguments = new HashSet<>(); if (!CollectionUtils.isEmpty(metadataRouterKeys)) { for (Map.Entry entry : metadataRouterLabels.entrySet()) { - routeArguments.add(RouteArgument.buildCustom(entry.getKey(), entry.getValue())); + routeArguments.add(RouteArgument.fromLabel(entry.getKey(), entry.getValue())); } } request.putRouterArgument(MetadataRouter.ROUTER_TYPE_METADATA, routeArguments); diff --git a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/RuleBasedRouterRequestInterceptor.java b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/RuleBasedRouterRequestInterceptor.java index 34814f650..ff8f2fb1b 100644 --- a/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/RuleBasedRouterRequestInterceptor.java +++ b/spring-cloud-starter-tencent-polaris-router/src/main/java/com/tencent/cloud/polaris/router/interceptor/RuleBasedRouterRequestInterceptor.java @@ -58,7 +58,7 @@ public class RuleBasedRouterRequestInterceptor implements RouterRequestIntercept Map ruleRouterLabels = routerContext.getLabels(RouterConstant.ROUTER_LABELS); if (!CollectionUtils.isEmpty(ruleRouterLabels)) { for (Map.Entry label : ruleRouterLabels.entrySet()) { - routeArguments.add(RouteArgument.buildCustom(label.getKey(), label.getValue())); + routeArguments.add(RouteArgument.fromLabel(label.getKey(), label.getValue())); } } }