You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by zh...@apache.org on 2022/06/08 10:43:53 UTC

[incubator-shenyu] branch master updated: [ISSUE 3407] sub task2 add the logic of annotation on the splicing class for alibaba dubbo client (#3411)

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

zhangzicheng 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 b869882d5 [ISSUE 3407] sub task2 add the logic of annotation on the splicing class for alibaba dubbo client (#3411)
b869882d5 is described below

commit b869882d5517f87b8906efc45edf37f7cfc1fcc3
Author: sunshujie1990 <su...@gmail.com>
AuthorDate: Wed Jun 8 18:43:48 2022 +0800

    [ISSUE 3407] sub task2 add the logic of annotation on the splicing class for alibaba dubbo client (#3411)
    
    * [ISSUE 3407] sub task2 add the logic of annotation on the splicing class for alibaba dubbo client
---
 .../dubbo/AlibabaDubboServiceBeanListener.java     |  41 +++++-
 ...l.java => DubboClassMultiParamServiceImpl.java} |  60 ++++----
 ...iceImpl.java => DubboClassTestServiceImpl.java} |  22 +--
 .../impl/DubboMultiParamServiceImpl.java           |   1 +
 .../annotation/impl/DubboTestServiceImpl.java      |   1 +
 .../impl/DubboClassMultiParamServiceImpl.java}     |  48 ++++---
 .../service/impl/DubboClassTestServiceImpl.java}   |  17 +--
 .../src/main/resources/spring-dubbo.xml            |   4 +
 ...babaDubboPluginMultiParamSplicingClassTest.java | 151 +++++++++++++++++++++
 .../dubbo/AlibabaDubboPluginSplicingClassTest.java |  73 ++++++++++
 10 files changed, 347 insertions(+), 71 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 458429cc1..0c484e360 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
@@ -35,6 +35,7 @@ import org.apache.shenyu.register.common.dto.URIRegisterDTO;
 import org.springframework.aop.support.AopUtils;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.lang.NonNull;
 import org.springframework.util.ReflectionUtils;
 
@@ -52,6 +53,11 @@ import java.util.stream.Collectors;
 //@SuppressWarnings("all")
 public class AlibabaDubboServiceBeanListener implements ApplicationListener<ContextRefreshedEvent> {
 
+    /**
+     * api path separator.
+     */
+    private static final String PATH_SEPARATOR = "/";
+
     private final ShenyuClientRegisterEventPublisher publisher = ShenyuClientRegisterEventPublisher.getInstance();
 
     private final AtomicBoolean registered = new AtomicBoolean(false);
@@ -99,17 +105,46 @@ public class AlibabaDubboServiceBeanListener implements ApplicationListener<Cont
         if (AopUtils.isAopProxy(refProxy)) {
             clazz = AopUtils.getTargetClass(refProxy);
         }
+        ShenyuDubboClient beanShenyuClient = AnnotationUtils.findAnnotation(clazz, ShenyuDubboClient.class);
+        final String superPath = buildApiSuperPath(beanShenyuClient);
+        if (superPath.contains("*")) {
+            Method[] methods = ReflectionUtils.getDeclaredMethods(clazz);
+            for (Method method : methods) {
+                if (Objects.nonNull(beanShenyuClient)) {
+                    publisher.publishEvent(buildMetaDataDTO(serviceBean, beanShenyuClient, method, superPath));
+                }
+            }
+            return;
+        }
         Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
         for (Method method : methods) {
             ShenyuDubboClient shenyuDubboClient = method.getAnnotation(ShenyuDubboClient.class);
             if (Objects.nonNull(shenyuDubboClient)) {
-                publisher.publishEvent(buildMetaDataDTO(serviceBean, shenyuDubboClient, method));
+                publisher.publishEvent(buildMetaDataDTO(serviceBean, shenyuDubboClient, method, superPath));
+            }
+        }
+    }
+
+    private String buildApiSuperPath(final ShenyuDubboClient shenyuDubboClient) {
+        if (Objects.nonNull(shenyuDubboClient) && !StringUtils.isBlank(shenyuDubboClient.path())) {
+            return shenyuDubboClient.path();
+        }
+        return "";
+    }
+
+    private String pathJoin(@NonNull final String... path) {
+        StringBuilder result = new StringBuilder(PATH_SEPARATOR);
+        for (String p : path) {
+            if (!result.toString().endsWith(PATH_SEPARATOR)) {
+                result.append(PATH_SEPARATOR);
             }
+            result.append(p.startsWith(PATH_SEPARATOR) ? p.replaceFirst(PATH_SEPARATOR, "") : p);
         }
+        return result.toString();
     }
 
-    private MetaDataRegisterDTO buildMetaDataDTO(final ServiceBean<?> serviceBean, final ShenyuDubboClient shenyuDubboClient, final Method method) {
-        String path = contextPath + shenyuDubboClient.path();
+    private MetaDataRegisterDTO buildMetaDataDTO(final ServiceBean<?> serviceBean, final ShenyuDubboClient shenyuDubboClient, final Method method, final String superPath) {
+        String path = superPath.contains("*") ? pathJoin(contextPath, superPath.replace("*", ""), method.getName()) : pathJoin(contextPath, superPath, shenyuDubboClient.path());
         String desc = shenyuDubboClient.desc();
         String serviceName = serviceBean.getInterface();
         String configRuleName = shenyuDubboClient.ruleName();
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassMultiParamServiceImpl.java
similarity index 67%
copy from shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
copy to shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassMultiParamServiceImpl.java
index 220e4b1c7..3098836d2 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassMultiParamServiceImpl.java
@@ -1,17 +1,18 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.shenyu.examples.alibaba.dubbo.service.annotation.impl;
@@ -20,7 +21,7 @@ import com.alibaba.dubbo.config.annotation.Service;
 import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;
 import org.apache.shenyu.examples.dubbo.api.entity.ComplexBeanTest;
 import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
-import org.apache.shenyu.examples.dubbo.api.service.DubboMultiParamService;
+import org.apache.shenyu.examples.dubbo.api.service.DubboClassMultiParamService;
 import org.springframework.lang.NonNull;
 
 import java.util.Arrays;
@@ -31,57 +32,62 @@ import java.util.stream.Collectors;
 /**
  * The type Dubbo multi param service.
  */
+@ShenyuDubboClient(path = "/demo")
 @Service
-public class DubboMultiParamServiceImpl implements DubboMultiParamService {
-    
+public class DubboClassMultiParamServiceImpl implements DubboClassMultiParamService {
+
     @Override
-    @ShenyuDubboClient(path = "/findByIdsAndName", desc = "Query by Ids and name")
+    @ShenyuDubboClient(path = "/findByIdsAndName", desc = "findByIdsAndName")
     public DubboTest findByIdsAndName(final List<Integer> ids, final String name) {
         return new DubboTest(ids.toString(), "hello world shenyu alibaba dubbo param findByIdsAndName :" + name);
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/findByArrayIdsAndName", desc = "findByArrayIdsAndName")
     public DubboTest findByArrayIdsAndName(final Integer[] ids, final String name) {
         return new DubboTest(Arrays.toString(ids), "hello world shenyu alibaba dubbo param findByArrayIdsAndName :" + name);
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/findByStringArray", desc = "findByStringArray")
     public DubboTest findByStringArray(final String[] ids) {
         return new DubboTest(Arrays.toString(ids), "hello world shenyu alibaba dubbo param findByStringArray");
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/findByListId", desc = "findByListId")
     public DubboTest findByListId(final List<String> ids) {
         return new DubboTest(ids.toString(), "hello world shenyu alibaba dubbo param findByListId");
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/batchSave", desc = "batchSave")
     public DubboTest batchSave(final List<DubboTest> dubboTestList) {
-        return new DubboTest(join(dubboTestList, DubboTest::getId), "hello world shenyu alibaba dubbo param batchSave :" + join(dubboTestList, DubboTest::getName));
+        return new DubboTest(join(dubboTestList, DubboTest::getId),
+                "hello world shenyu alibaba dubbo param batchSave :" + join(dubboTestList, DubboTest::getName));
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/batchSaveAndNameAndId", desc = "batchSaveAndNameAndId")
     public DubboTest batchSaveAndNameAndId(final List<DubboTest> dubboTestList, final String id, final String name) {
-        return new DubboTest(id, "hello world shenyu alibaba dubbo param batchSaveAndNameAndId :" + name + ":" + join(dubboTestList, DubboTest::getName));
+        return new DubboTest(id, "hello world shenyu alibaba dubbo param batchSaveAndNameAndId :"
+                + name + ":" + join(dubboTestList, DubboTest::getName));
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/saveComplexBeanTest", desc = "saveComplexBeanTest")
     public DubboTest saveComplexBeanTest(final ComplexBeanTest complexBeanTest) {
-        return new DubboTest(complexBeanTest.getIdLists().toString(), "hello world shenyu alibaba dubbo param saveComplexBeanTest :" + complexBeanTest.getDubboTest().getName());
+        return new DubboTest(complexBeanTest.getIdLists().toString(),
+                "hello world shenyu alibaba dubbo param saveComplexBeanTest :" + complexBeanTest.getDubboTest().getName());
     }
-    
+
     @Override
     @ShenyuDubboClient(path = "/saveComplexBeanTestAndName", desc = "saveComplexBeanTestAndName")
     public DubboTest saveComplexBeanTestAndName(final ComplexBeanTest complexBeanTest, final String name) {
-        return new DubboTest(complexBeanTest.getIdLists().toString(), "hello world shenyu alibaba dubbo param saveComplexBeanTestAndName :" + complexBeanTest.getDubboTest().getName() + "-" + name);
+        return new DubboTest(complexBeanTest.getIdLists().toString(),
+                "hello world shenyu alibaba dubbo param saveComplexBeanTestAndName :" + complexBeanTest.getDubboTest().getName() + "-" + name);
     }
-    
+
     private <T> String join(final @NonNull List<T> list, final Function<T, String> mapper) {
         return list.stream()
                 .map(mapper)
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassTestServiceImpl.java
similarity index 81%
copy from shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
copy to shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassTestServiceImpl.java
index 664b714f1..2f28d211c 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboClassTestServiceImpl.java
@@ -16,11 +16,16 @@
 
 package org.apache.shenyu.examples.alibaba.dubbo.service.annotation.impl;
 
+
 import com.alibaba.dubbo.config.annotation.Service;
+import com.alibaba.dubbo.rpc.RpcContext;
 import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;
+import org.apache.shenyu.common.utils.GsonUtils;
 import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
 import org.apache.shenyu.examples.dubbo.api.entity.ListResp;
-import org.apache.shenyu.examples.dubbo.api.service.DubboTestService;
+import org.apache.shenyu.examples.dubbo.api.service.DubboClassTestService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Collections;
 import java.util.Random;
@@ -28,30 +33,27 @@ import java.util.Random;
 /**
  * The type Dubbo service.
  */
+@ShenyuDubboClient(path = "/demo/**", desc = "class init")
 @Service
-public class DubboTestServiceImpl implements DubboTestService {
-    
+public class DubboClassTestServiceImpl implements DubboClassTestService {
+
     @Override
-    @ShenyuDubboClient(path = "/findById", desc = "Query by Id")
     public DubboTest findById(final String id) {
         return new DubboTest(id, "hello world shenyu Alibaba Dubbo, findById");
     }
-    
+
     @Override
-    @ShenyuDubboClient(path = "/findAll", desc = "Get all data")
     public DubboTest findAll() {
         return new DubboTest(String.valueOf(new Random().nextInt()), "hello world shenyu Alibaba Dubbo , findAll");
     }
-    
+
     @Override
-    @ShenyuDubboClient(path = "/insert", desc = "Insert a row of data")
     public DubboTest insert(final DubboTest dubboTest) {
         dubboTest.setName("hello world shenyu Alibaba Dubbo: " + dubboTest.getName());
         return dubboTest;
     }
-    
+
     @Override
-    @ShenyuDubboClient(path = "/findList", desc = "Find list")
     public ListResp findList() {
         return new ListResp(1, Collections.singletonList(new DubboTest("1", "test")));
     }
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
index 220e4b1c7..56cfe2c7b 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
  * The type Dubbo multi param service.
  */
 @Service
+@ShenyuDubboClient(path = "/demo")
 public class DubboMultiParamServiceImpl implements DubboMultiParamService {
     
     @Override
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
index 664b714f1..204470a84 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
@@ -29,6 +29,7 @@ import java.util.Random;
  * The type Dubbo service.
  */
 @Service
+@ShenyuDubboClient(path = "/demo")
 public class DubboTestServiceImpl implements DubboTestService {
     
     @Override
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassMultiParamServiceImpl.java
similarity index 64%
copy from shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
copy to shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassMultiParamServiceImpl.java
index 220e4b1c7..27996573f 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboMultiParamServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassMultiParamServiceImpl.java
@@ -1,27 +1,28 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-package org.apache.shenyu.examples.alibaba.dubbo.service.annotation.impl;
+package org.apache.shenyu.examples.alibaba.dubbo.service.impl;
 
-import com.alibaba.dubbo.config.annotation.Service;
 import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;
 import org.apache.shenyu.examples.dubbo.api.entity.ComplexBeanTest;
 import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
-import org.apache.shenyu.examples.dubbo.api.service.DubboMultiParamService;
+import org.apache.shenyu.examples.dubbo.api.service.DubboClassMultiParamService;
 import org.springframework.lang.NonNull;
+import org.springframework.stereotype.Service;
 
 import java.util.Arrays;
 import java.util.List;
@@ -31,11 +32,12 @@ import java.util.stream.Collectors;
 /**
  * The type Dubbo multi param service.
  */
-@Service
-public class DubboMultiParamServiceImpl implements DubboMultiParamService {
+@Service("dubboClassMultiParamService")
+@ShenyuDubboClient(path = "/demo")
+public class DubboClassMultiParamServiceImpl implements DubboClassMultiParamService {
     
     @Override
-    @ShenyuDubboClient(path = "/findByIdsAndName", desc = "Query by Ids and name")
+    @ShenyuDubboClient(path = "/findByIdsAndName", desc = "findByIdsAndName")
     public DubboTest findByIdsAndName(final List<Integer> ids, final String name) {
         return new DubboTest(ids.toString(), "hello world shenyu alibaba dubbo param findByIdsAndName :" + name);
     }
@@ -61,25 +63,29 @@ public class DubboMultiParamServiceImpl implements DubboMultiParamService {
     @Override
     @ShenyuDubboClient(path = "/batchSave", desc = "batchSave")
     public DubboTest batchSave(final List<DubboTest> dubboTestList) {
-        return new DubboTest(join(dubboTestList, DubboTest::getId), "hello world shenyu alibaba dubbo param batchSave :" + join(dubboTestList, DubboTest::getName));
+        return new DubboTest(join(dubboTestList, DubboTest::getId),
+                "hello world shenyu alibaba dubbo param batchSave :" + join(dubboTestList, DubboTest::getName));
     }
     
     @Override
     @ShenyuDubboClient(path = "/batchSaveAndNameAndId", desc = "batchSaveAndNameAndId")
     public DubboTest batchSaveAndNameAndId(final List<DubboTest> dubboTestList, final String id, final String name) {
-        return new DubboTest(id, "hello world shenyu alibaba dubbo param batchSaveAndNameAndId :" + name + ":" + join(dubboTestList, DubboTest::getName));
+        return new DubboTest(id, "hello world shenyu alibaba dubbo param batchSaveAndNameAndId :"
+                + name + ":" + join(dubboTestList, DubboTest::getName));
     }
     
     @Override
     @ShenyuDubboClient(path = "/saveComplexBeanTest", desc = "saveComplexBeanTest")
     public DubboTest saveComplexBeanTest(final ComplexBeanTest complexBeanTest) {
-        return new DubboTest(complexBeanTest.getIdLists().toString(), "hello world shenyu alibaba dubbo param saveComplexBeanTest :" + complexBeanTest.getDubboTest().getName());
+        return new DubboTest(complexBeanTest.getIdLists().toString(),
+                "hello world shenyu alibaba dubbo param saveComplexBeanTest :" + complexBeanTest.getDubboTest().getName());
     }
     
     @Override
     @ShenyuDubboClient(path = "/saveComplexBeanTestAndName", desc = "saveComplexBeanTestAndName")
     public DubboTest saveComplexBeanTestAndName(final ComplexBeanTest complexBeanTest, final String name) {
-        return new DubboTest(complexBeanTest.getIdLists().toString(), "hello world shenyu alibaba dubbo param saveComplexBeanTestAndName :" + complexBeanTest.getDubboTest().getName() + "-" + name);
+        return new DubboTest(complexBeanTest.getIdLists().toString(),
+                "hello world shenyu alibaba dubbo param saveComplexBeanTestAndName :" + complexBeanTest.getDubboTest().getName() + "-" + name);
     }
     
     private <T> String join(final @NonNull List<T> list, final Function<T, String> mapper) {
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassTestServiceImpl.java
similarity index 75%
copy from shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
copy to shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassTestServiceImpl.java
index 664b714f1..d5f046af2 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service-annotation/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/annotation/impl/DubboTestServiceImpl.java
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/java/org/apache/shenyu/examples/alibaba/dubbo/service/impl/DubboClassTestServiceImpl.java
@@ -14,44 +14,41 @@
  *
  */
 
-package org.apache.shenyu.examples.alibaba.dubbo.service.annotation.impl;
+package org.apache.shenyu.examples.alibaba.dubbo.service.impl;
 
-import com.alibaba.dubbo.config.annotation.Service;
 import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;
 import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
 import org.apache.shenyu.examples.dubbo.api.entity.ListResp;
-import org.apache.shenyu.examples.dubbo.api.service.DubboTestService;
+import org.apache.shenyu.examples.dubbo.api.service.DubboClassTestService;
+import org.springframework.stereotype.Service;
 
 import java.util.Collections;
 import java.util.Random;
 
 /**
- * The type Dubbo service.
+ * DubboTestServiceImpl.
  */
-@Service
-public class DubboTestServiceImpl implements DubboTestService {
+@Service("dubboClassTestService")
+@ShenyuDubboClient(path = "/demo/**", desc = "class init")
+public class DubboClassTestServiceImpl implements DubboClassTestService {
     
     @Override
-    @ShenyuDubboClient(path = "/findById", desc = "Query by Id")
     public DubboTest findById(final String id) {
         return new DubboTest(id, "hello world shenyu Alibaba Dubbo, findById");
     }
     
     @Override
-    @ShenyuDubboClient(path = "/findAll", desc = "Get all data")
     public DubboTest findAll() {
         return new DubboTest(String.valueOf(new Random().nextInt()), "hello world shenyu Alibaba Dubbo , findAll");
     }
     
     @Override
-    @ShenyuDubboClient(path = "/insert", desc = "Insert a row of data")
     public DubboTest insert(final DubboTest dubboTest) {
         dubboTest.setName("hello world shenyu Alibaba Dubbo: " + dubboTest.getName());
         return dubboTest;
     }
     
     @Override
-    @ShenyuDubboClient(path = "/findList", desc = "Find list")
     public ListResp findList() {
         return new ListResp(1, Collections.singletonList(new DubboTest("1", "test")));
     }
diff --git a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
index 8d4845ee1..426684189 100644
--- a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
+++ b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-alibaba-dubbo-service/src/main/resources/spring-dubbo.xml
@@ -33,4 +33,8 @@
     <dubbo:service timeout="10000" interface="org.apache.shenyu.examples.dubbo.api.service.DubboTestService" ref="dubboTestService"/>
 
     <dubbo:service timeout="10000" interface="org.apache.shenyu.examples.dubbo.api.service.DubboMultiParamService" ref="dubboMultiParamService"/>
+
+    <dubbo:service timeout="10000" interface="org.apache.shenyu.examples.dubbo.api.service.DubboClassTestService" ref="dubboClassTestService"/>
+
+    <dubbo:service timeout="10000" interface="org.apache.shenyu.examples.dubbo.api.service.DubboClassMultiParamService" ref="dubboClassMultiParamService"/>
 </beans>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginMultiParamSplicingClassTest.java b/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginMultiParamSplicingClassTest.java
new file mode 100644
index 000000000..3dca57e31
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginMultiParamSplicingClassTest.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.alibaba.dubbo;
+
+import com.google.common.collect.Lists;
+import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.dto.ComplexBeanTest;
+import org.apache.shenyu.integratedtest.common.dto.ComplexBeanTestWithNameRequest;
+import org.apache.shenyu.integratedtest.common.dto.DubboTest;
+import org.apache.shenyu.integratedtest.common.dto.DubboTestListRequest;
+import org.apache.shenyu.integratedtest.common.dto.DubboTestListWithIdAndNameRequest;
+import org.apache.shenyu.integratedtest.common.dto.IdArrayAndNameRequest;
+import org.apache.shenyu.integratedtest.common.dto.IdStringArrayRequest;
+import org.apache.shenyu.integratedtest.common.dto.IdStringListRequest;
+import org.apache.shenyu.integratedtest.common.dto.IdsAndNameRequest;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.IntStream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class AlibabaDubboPluginMultiParamSplicingClassTest extends AbstractPluginDataInit {
+
+    @BeforeAll
+    public static void setup() throws IOException {
+        String pluginResult = initPlugin(PluginEnum.DUBBO.getName(), "{\"register\":\"zookeeper://shenyu-zk:2181\"}");
+        assertThat(pluginResult, is("success"));
+    }
+
+    @Test
+    public void testFindByIdsAndName() throws IOException {
+        final IdsAndNameRequest idsAndNameRequest = new IdsAndNameRequest();
+        idsAndNameRequest.setName("name");
+        idsAndNameRequest.setIds(Lists.newArrayList(123, 124, 125));
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/findByIdsAndName", idsAndNameRequest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param findByIdsAndName :name", dubboTest.getName());
+        assertEquals("[123, 124, 125]", dubboTest.getId());
+    }
+
+    @Test
+    public void testFindByArrayIdsAndName() throws IOException {
+        final IdArrayAndNameRequest idArrayAndNameRequest = new IdArrayAndNameRequest();
+        idArrayAndNameRequest.setName("name");
+        idArrayAndNameRequest.setIds(IntStream.of(123, 124, 125).boxed().toArray(Integer[]::new));
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/findByArrayIdsAndName", idArrayAndNameRequest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param findByArrayIdsAndName :name", dubboTest.getName());
+        assertEquals("[123, 124, 125]", dubboTest.getId());
+    }
+
+    @Test
+    public void testFindByStringArray() throws IOException {
+        final IdStringArrayRequest idStringArrayRequest = new IdStringArrayRequest();
+        idStringArrayRequest.setIds(IntStream.of(123, 124, 125).mapToObj(String::valueOf).toArray(String[]::new));
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/findByStringArray", idStringArrayRequest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param findByStringArray", dubboTest.getName());
+        assertEquals("[123, 124, 125]", dubboTest.getId());
+    }
+
+    @Test
+    public void testFindByListId() throws IOException {
+        final IdStringListRequest idStringListRequest = new IdStringListRequest();
+        idStringListRequest.setIds(Lists.newArrayList("123", "124", "125"));
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/findByListId", idStringListRequest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param findByListId", dubboTest.getName());
+        assertEquals("[123, 124, 125]", dubboTest.getId());
+    }
+
+    @Test
+    public void testBatchSave() throws IOException {
+        final DubboTestListRequest dubboTestListRequest = new DubboTestListRequest();
+        List<DubboTest> dubboTestList = new ArrayList<>();
+        dubboTestList.add(new DubboTest("123", "name123"));
+        dubboTestList.add(new DubboTest("124", "name124"));
+        dubboTestList.add(new DubboTest("125", "name125"));
+        dubboTestListRequest.setDubboTestList(dubboTestList);
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/batchSave", dubboTestListRequest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param batchSave :name123-name124-name125", dubboTest.getName());
+        assertEquals("123-124-125", dubboTest.getId());
+    }
+
+    @Test
+    public void testBatchSaveAndNameAndId() throws IOException {
+        final DubboTestListWithIdAndNameRequest request = new DubboTestListWithIdAndNameRequest();
+        request.setId("122");
+        request.setName("name122");
+        List<DubboTest> dubboTestList = new ArrayList<>();
+        dubboTestList.add(new DubboTest("123", "name123"));
+        dubboTestList.add(new DubboTest("124", "name124"));
+        dubboTestList.add(new DubboTest("125", "name125"));
+        request.setDubboTestList(dubboTestList);
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/batchSaveAndNameAndId", request, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param batchSaveAndNameAndId :name122:name123-name124-name125", dubboTest.getName());
+        assertEquals("122", dubboTest.getId());
+    }
+
+    @Test
+    public void testSaveComplexBeanTest() throws IOException {
+        final ComplexBeanTest complexBeanTest = new ComplexBeanTest();
+        complexBeanTest.setDubboTest(new DubboTest("122", "name"));
+        complexBeanTest.setIdLists(Lists.newArrayList("123", "124"));
+        Map<String, String> idMaps = new HashMap<>();
+        idMaps.put("key_abc", "value_abc");
+        idMaps.put("key_cbd", "value_cbd");
+        complexBeanTest.setIdMaps(idMaps);
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/saveComplexBeanTest", complexBeanTest, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param saveComplexBeanTest :name", dubboTest.getName());
+        assertEquals("[123, 124]", dubboTest.getId());
+    }
+
+    @Test
+    public void testSaveComplexBeanTestAndName() throws IOException {
+        final ComplexBeanTestWithNameRequest request = new ComplexBeanTestWithNameRequest();
+        ComplexBeanTest complexBeanTest = new ComplexBeanTest();
+        complexBeanTest.setDubboTest(new DubboTest("122", "name122"));
+        complexBeanTest.setIdLists(Lists.newArrayList("123", "124"));
+        Map<String, String> idMaps = new HashMap<>();
+        idMaps.put("key_abc", "value_abc");
+        idMaps.put("key_cbd", "value_cbd");
+        complexBeanTest.setIdMaps(idMaps);
+        request.setComplexBeanTest(complexBeanTest);
+        request.setName("name");
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/saveComplexBeanTestAndName", request, DubboTest.class);
+        assertEquals("hello world shenyu alibaba dubbo param saveComplexBeanTestAndName :name122-name", dubboTest.getName());
+        assertEquals("[123, 124]", dubboTest.getId());
+    }
+}
diff --git a/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginSplicingClassTest.java b/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginSplicingClassTest.java
new file mode 100644
index 000000000..8fcfc42df
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-alibaba-dubbo/src/test/java/org/apache/shenyu/integrated/test/alibaba/dubbo/AlibabaDubboPluginSplicingClassTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.alibaba.dubbo;
+
+import com.google.gson.reflect.TypeToken;
+import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.dto.DubboTest;
+import org.apache.shenyu.integratedtest.common.dto.ListResp;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class AlibabaDubboPluginSplicingClassTest extends AbstractPluginDataInit {
+
+    @BeforeAll
+    public static void setup() throws IOException {
+        String pluginResult = initPlugin(PluginEnum.DUBBO.getName(), "{\"register\":\"zookeeper://shenyu-zk:2181\"}");
+        assertThat(pluginResult, is("success"));
+    }
+
+    @Test
+    public void testFindById() throws IOException {
+        DubboTest dubboTest = HttpHelper.INSTANCE.getFromGateway("/dubbo/demo/findById?id=1", new TypeToken<DubboTest>() {
+        }.getType());
+        assertEquals("hello world shenyu Alibaba Dubbo, findById", dubboTest.getName());
+    }
+
+    @Test
+    public void testFindAll() throws IOException {
+        DubboTest dubboTest = HttpHelper.INSTANCE.getFromGateway("/dubbo/demo/findAll", DubboTest.class);
+        assertEquals("hello world shenyu Alibaba Dubbo , findAll", dubboTest.getName());
+    }
+
+    @Test
+    public void testInsert() throws IOException {
+        DubboTest req = new DubboTest("1", "insertName");
+        DubboTest dubboTest = HttpHelper.INSTANCE.postGateway("/dubbo/demo/insert", req, DubboTest.class);
+        assertEquals("hello world shenyu Alibaba Dubbo: insertName", dubboTest.getName());
+        assertEquals("1", dubboTest.getId());
+    }
+
+    @Test
+    public void testFindList() throws IOException {
+        ListResp listResp = HttpHelper.INSTANCE.getFromGateway("/dubbo/demo/findList", ListResp.class);
+        List<DubboTest> users = listResp.getUsers();
+        assertEquals(listResp.getTotal().intValue(), users.size());
+        assertEquals("test", users.get(0).getName());
+        assertEquals("1", users.get(0).getId());
+    }
+}