You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2021/10/08 03:02:20 UTC

[incubator-shenyu] branch master updated: Revert "optimization client build path (#2172)" (#2185)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 35df916  Revert "optimization client build path (#2172)" (#2185)
35df916 is described below

commit 35df916ed39b2356ad8bcd803d75c8049872fcd3
Author: Qicz <qi...@gmail.com>
AuthorDate: Fri Oct 8 11:02:16 2021 +0800

    Revert "optimization client build path (#2172)" (#2185)
    
    This reverts commit 474505b6ec34069ea7dd7b20555bbec2f5f74be1.
---
 .../client/alibaba/dubbo/AlibabaDubboServiceBeanListener.java  |  9 ++++-----
 .../client/apache/dubbo/ApacheDubboServiceBeanListener.java    |  7 +++----
 .../apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java |  9 ++++-----
 .../client/springcloud/init/ContextRegisterListener.java       |  6 +++---
 .../springcloud/init/SpringCloudClientBeanPostProcessor.java   | 10 ++--------
 .../shenyu/client/springmvc/init/ContextRegisterListener.java  |  6 +++---
 .../springmvc/init/SpringMvcClientBeanPostProcessor.java       |  7 +++----
 .../shenyu/client/motan/MotanServiceBeanPostProcessor.java     |  3 +--
 .../shenyu/client/sofa/SofaServiceBeanPostProcessor.java       |  7 +++----
 .../shenyu/client/tars/TarsServiceBeanPostProcessor.java       |  7 +++----
 10 files changed, 29 insertions(+), 42 deletions(-)

diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-alibaba-dubbo/src/main/java/org/apache/shenyu/client/alibaba/dubbo/AlibabaDubboServiceBeanListener.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-alibaba-dubbo/src/main/java/org/apache/shenyu/client/alibaba/dubbo/AlibabaDubboServiceBeanListener.java
index 25111ff..2e61abc 100644
--- a/shenyu-client/shenyu-client-dubbo/shenyu-client-alibaba-dubbo/src/main/java/org/apache/shenyu/client/alibaba/dubbo/AlibabaDubboServiceBeanListener.java
+++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-alibaba-dubbo/src/main/java/org/apache/shenyu/client/alibaba/dubbo/AlibabaDubboServiceBeanListener.java
@@ -18,9 +18,9 @@
 package org.apache.shenyu.client.alibaba.dubbo;
 
 import com.alibaba.dubbo.common.Constants;
+import com.alibaba.dubbo.common.utils.StringUtils;
 import com.alibaba.dubbo.config.spring.ServiceBean;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher;
 import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;
 import org.apache.shenyu.client.dubbo.common.dto.DubboRpcExt;
@@ -35,7 +35,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.util.ReflectionUtils;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Objects;
@@ -69,8 +68,8 @@ public class AlibabaDubboServiceBeanListener implements ApplicationListener<Cont
         Properties props = config.getProps();
         String contextPath = props.getProperty("contextPath");
         String appName = props.getProperty("appName");
-        if (StringUtils.isEmpty(contextPath) || contextPath.charAt(0) != '/') {
-            throw new RuntimeException("apache dubbo client must config the contextPath and must begin with '/'");
+        if (StringUtils.isEmpty(contextPath)) {
+            throw new RuntimeException("apache dubbo client must config the contextPath");
         }
         this.contextPath = contextPath;
         this.appName = appName;
@@ -100,7 +99,7 @@ public class AlibabaDubboServiceBeanListener implements ApplicationListener<Cont
         if (StringUtils.isEmpty(appName)) {
             appName = serviceBean.getApplication().getName();
         }
-        String path = Paths.get(contextPath, shenyuDubboClient.path()).toString();
+        String path = contextPath + shenyuDubboClient.path();
         String desc = shenyuDubboClient.desc();
         String serviceName = serviceBean.getInterface();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/main/java/org/apache/shenyu/client/apache/dubbo/ApacheDubboServiceBeanListener.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/main/java/org/apache/shenyu/client/apache/dubbo/ApacheDubboServiceBeanListener.java
index 729df54..b453658 100644
--- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/main/java/org/apache/shenyu/client/apache/dubbo/ApacheDubboServiceBeanListener.java
+++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/main/java/org/apache/shenyu/client/apache/dubbo/ApacheDubboServiceBeanListener.java
@@ -35,7 +35,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.util.ReflectionUtils;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Objects;
@@ -69,8 +68,8 @@ public class ApacheDubboServiceBeanListener implements ApplicationListener<Conte
         Properties props = config.getProps();
         String contextPath = props.getProperty("contextPath");
         String appName = props.getProperty("appName");
-        if (StringUtils.isEmpty(contextPath) || contextPath.charAt(0) != '/') {
-            throw new RuntimeException("apache dubbo client must config the contextPath and must begin with '/'");
+        if (StringUtils.isEmpty(contextPath)) {
+            throw new RuntimeException("apache dubbo client must config the contextPath");
         }
         this.contextPath = contextPath;
         this.appName = appName;
@@ -100,7 +99,7 @@ public class ApacheDubboServiceBeanListener implements ApplicationListener<Conte
         if (StringUtils.isEmpty(appName)) {
             appName = serviceBean.getApplication().getName();
         }
-        String path = Paths.get(contextPath, shenyuDubboClient.path()).toString();
+        String path = contextPath + shenyuDubboClient.path();
         String desc = shenyuDubboClient.desc();
         String serviceName = serviceBean.getInterface();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
diff --git a/shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java b/shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java
index 6a4e15f..9945df2 100644
--- a/shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java
@@ -22,7 +22,6 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import io.grpc.BindableService;
 import io.grpc.MethodDescriptor;
 import io.grpc.ServerServiceDefinition;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher;
 import org.apache.shenyu.client.grpc.common.annotation.ShenyuGrpcClient;
 import org.apache.shenyu.client.grpc.common.dto.GrpcExt;
@@ -38,10 +37,10 @@ import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.lang.NonNull;
 import org.springframework.util.ReflectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
@@ -82,8 +81,8 @@ public class GrpcClientBeanPostProcessor implements BeanPostProcessor {
         String contextPath = props.getProperty("contextPath");
         String ipAndPort = props.getProperty("ipAndPort");
         String port = props.getProperty("port");
-        if (StringUtils.isAnyBlank(contextPath, ipAndPort, port) || contextPath.charAt(0) != '/') {
-            throw new RuntimeException("grpc client must config the contextPath, ipAndPort, and contextPath must begin with '/'");
+        if (StringUtils.isEmpty(contextPath) || StringUtils.isEmpty(ipAndPort) || StringUtils.isEmpty(port)) {
+            throw new RuntimeException("grpc client must config the contextPath, ipAndPort");
         }
         this.ipAndPort = ipAndPort;
         this.contextPath = contextPath;
@@ -136,7 +135,7 @@ public class GrpcClientBeanPostProcessor implements BeanPostProcessor {
     }
 
     private MetaDataRegisterDTO buildMetaDataDTO(final String packageName, final ShenyuGrpcClient shenyuGrpcClient, final Method method) {
-        String path = Paths.get(contextPath, shenyuGrpcClient.path()).toString();
+        String path = this.contextPath + shenyuGrpcClient.path();
         String desc = shenyuGrpcClient.desc();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
         String configRuleName = shenyuGrpcClient.ruleName();
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/ContextRegisterListener.java b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/ContextRegisterListener.java
index f5c9aa5..a0be5e2 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/ContextRegisterListener.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/ContextRegisterListener.java
@@ -31,7 +31,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.core.env.Environment;
 import org.springframework.lang.NonNull;
 
-import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -70,7 +69,8 @@ public class ContextRegisterListener implements ApplicationListener<ContextRefre
             String serverLists = config.getServerLists();
             String contextPath = props.getProperty("contextPath");
             String appName = env.getProperty("spring.application.name");
-            if (StringUtils.isAnyBlank(contextPath, registerType, serverLists, appName)) {
+            if (StringUtils.isBlank(contextPath) || StringUtils.isBlank(registerType)
+                    || StringUtils.isBlank(serverLists) || StringUtils.isBlank(appName)) {
                 String errorMsg = "spring cloud param must config the contextPath ,registerType , serverLists  and appName";
                 LOG.error(errorMsg);
                 throw new RuntimeException(errorMsg);
@@ -96,7 +96,7 @@ public class ContextRegisterListener implements ApplicationListener<ContextRefre
         String appName = env.getProperty("spring.application.name");
         Integer port = env.getProperty("server.port", Integer.class, 8080);
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
-        String path = Paths.get("/", contextPath, "/**").toString();
+        String path = contextPath + "/**";
         return MetaDataRegisterDTO.builder()
                 .contextPath(contextPath)
                 .appName(appName)
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessor.java b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessor.java
index 1be0b01..4240282 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessor.java
@@ -38,7 +38,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.Objects;
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
@@ -78,7 +77,7 @@ public class SpringCloudClientBeanPostProcessor implements BeanPostProcessor {
         String registerType = config.getRegisterType();
         String serverLists = config.getServerLists();
         String appName = env.getProperty("spring.application.name");
-        if (StringUtils.isAnyBlank(registerType, serverLists, appName)) {
+        if (StringUtils.isBlank(registerType) || StringUtils.isBlank(serverLists) || StringUtils.isBlank(appName)) {
             String errorMsg = "spring cloud param must config the registerType , serverLists  and appName";
             LOG.error(errorMsg);
             throw new RuntimeException(errorMsg);
@@ -129,12 +128,7 @@ public class SpringCloudClientBeanPostProcessor implements BeanPostProcessor {
     private MetaDataRegisterDTO buildMetaDataDTO(final ShenyuSpringCloudClient shenyuSpringCloudClient, final String prePath) {
         String contextPath = StringUtils.isBlank(this.contextPath) ? this.servletContextPath : this.contextPath;
         String appName = env.getProperty("spring.application.name");
-        String path;
-        if (StringUtils.isEmpty(contextPath)) {
-            path = Paths.get("/", prePath, shenyuSpringCloudClient.path()).toString();
-        } else {
-            path = Paths.get("/", contextPath, prePath, shenyuSpringCloudClient.path()).toString();
-        }
+        String path = contextPath + prePath + shenyuSpringCloudClient.path();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
         int port = StringUtils.isBlank(this.port) ? -1 : Integer.parseInt(this.port);
         String desc = shenyuSpringCloudClient.desc();
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/ContextRegisterListener.java b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/ContextRegisterListener.java
index b87767d..2631086 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/ContextRegisterListener.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/ContextRegisterListener.java
@@ -30,7 +30,6 @@ import org.springframework.context.ApplicationListener;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.lang.NonNull;
 
-import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -69,7 +68,8 @@ public class ContextRegisterListener implements ApplicationListener<ContextRefre
             String serverLists = config.getServerLists();
             String contextPath = props.getProperty("contextPath");
             int port = Integer.parseInt(props.getProperty("port"));
-            if (StringUtils.isAnyBlank(contextPath, registerType, serverLists) || port <= 0) {
+            if (StringUtils.isBlank(contextPath) || StringUtils.isBlank(registerType)
+                    || StringUtils.isBlank(serverLists) || port <= 0) {
                 String errorMsg = "http register param must config the contextPath, registerType , serverLists and port must > 0";
                 LOG.error(errorMsg);
                 throw new RuntimeException(errorMsg);
@@ -97,7 +97,7 @@ public class ContextRegisterListener implements ApplicationListener<ContextRefre
         String contextPath = this.contextPath;
         String appName = this.appName;
         Integer port = this.port;
-        String path = Paths.get("/", contextPath, "/**").toString();
+        String path = contextPath + "/**";
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
         return MetaDataRegisterDTO.builder()
                 .contextPath(contextPath)
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientBeanPostProcessor.java b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientBeanPostProcessor.java
index 19e1975..31cce98 100644
--- a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/main/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientBeanPostProcessor.java
@@ -36,7 +36,6 @@ import org.springframework.util.ReflectionUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.Objects;
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
@@ -71,7 +70,7 @@ public class SpringMvcClientBeanPostProcessor implements BeanPostProcessor {
         String serverLists = config.getServerLists();
         Properties props = config.getProps();
         int port = Integer.parseInt(props.getProperty("port"));
-        if (StringUtils.isAnyBlank(registerType, serverLists) || port <= 0) {
+        if (StringUtils.isBlank(registerType) || StringUtils.isBlank(serverLists) || port <= 0) {
             String errorMsg = "http register param must config the registerType , serverLists and port must > 0";
             LOG.error(errorMsg);
             throw new RuntimeException(errorMsg);
@@ -122,9 +121,9 @@ public class SpringMvcClientBeanPostProcessor implements BeanPostProcessor {
         Integer port = this.port;
         String path;
         if (StringUtils.isEmpty(contextPath)) {
-            path = Paths.get("/", prePath, shenyuSpringMvcClient.path()).toString();
+            path = prePath + shenyuSpringMvcClient.path();
         } else {
-            path = Paths.get("/", contextPath, prePath, shenyuSpringMvcClient.path()).toString();
+            path = contextPath + prePath + shenyuSpringMvcClient.path();
         }
         String desc = shenyuSpringMvcClient.desc();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
diff --git a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceBeanPostProcessor.java b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceBeanPostProcessor.java
index 4aa9fce..f38358f 100644
--- a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceBeanPostProcessor.java
@@ -39,7 +39,6 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
 import org.springframework.util.ReflectionUtils;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -122,7 +121,7 @@ public class MotanServiceBeanPostProcessor implements BeanPostProcessor, Applica
     private MetaDataRegisterDTO buildMetaDataDTO(final Class<?> clazz, final MotanService service,
                                                  final ShenyuMotanClient shenyuMotanClient, final Method method, final String rpcExt) {
         String appName = this.appName;
-        String path = Paths.get("/", this.contextPath, shenyuMotanClient.path()).toString();
+        String path = this.contextPath + shenyuMotanClient.path();
         String desc = shenyuMotanClient.desc();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
         int port = StringUtils.isBlank(this.port) ? -1 : Integer.parseInt(this.port);
diff --git a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceBeanPostProcessor.java b/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceBeanPostProcessor.java
index e87b008..be563c1 100644
--- a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceBeanPostProcessor.java
@@ -39,7 +39,6 @@ import org.springframework.util.ReflectionUtils;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
-import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Objects;
 import java.util.Properties;
@@ -70,8 +69,8 @@ public class SofaServiceBeanPostProcessor implements BeanPostProcessor {
         Properties props = config.getProps();
         String contextPath = props.getProperty("contextPath");
         String appName = props.getProperty("appName");
-        if (StringUtils.isEmpty(contextPath) || contextPath.charAt(0) != '/') {
-            throw new RuntimeException("sofa client must config the contextPath and contextPath must begin with '/'");
+        if (StringUtils.isEmpty(contextPath)) {
+            throw new RuntimeException("sofa client must config the contextPath");
         }
         this.contextPath = contextPath;
         this.appName = appName;
@@ -113,7 +112,7 @@ public class SofaServiceBeanPostProcessor implements BeanPostProcessor {
 
     private MetaDataRegisterDTO buildMetaDataDTO(final ServiceFactoryBean serviceBean, final ShenyuSofaClient shenyuSofaClient, final Method method) {
         String appName = this.appName;
-        String path = Paths.get(this.contextPath, shenyuSofaClient.path()).toString();
+        String path = contextPath + shenyuSofaClient.path();
         String desc = shenyuSofaClient.desc();
         String serviceName = serviceBean.getInterfaceClass().getName();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java
index 53b9451..16adc75 100644
--- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java
@@ -36,7 +36,6 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
 import org.springframework.util.ReflectionUtils;
 
 import java.lang.reflect.Method;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -70,8 +69,8 @@ public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
         String contextPath = props.getProperty("contextPath");
         String ip = props.getProperty("host");
         String port = props.getProperty("port");
-        if (StringUtils.isAnyBlank(contextPath, ip, port) || contextPath.charAt(0) != '/') {
-            throw new RuntimeException("tars client must config the contextPath, ipAndPort, and contextPath must begin with '/'");
+        if (StringUtils.isEmpty(contextPath) || StringUtils.isEmpty(ip) || StringUtils.isEmpty(port)) {
+            throw new RuntimeException("tars client must config the contextPath, ipAndPort");
         }
         this.contextPath = contextPath;
         this.ipAndPort = ip + ":" + port;
@@ -106,7 +105,7 @@ public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
 
     private MetaDataRegisterDTO buildMetaDataDTO(final String serviceName, final ShenyuTarsClient shenyuTarsClient, final Method method, final String rpcExt) {
         String ipAndPort = this.ipAndPort;
-        String path = Paths.get(this.contextPath, shenyuTarsClient.path()).toString();
+        String path = this.contextPath + shenyuTarsClient.path();
         String desc = shenyuTarsClient.desc();
         String host = IpUtils.isCompleteHost(this.host) ? this.host : IpUtils.getHost(this.host);
         String configRuleName = shenyuTarsClient.ruleName();