dragon-zhang commented on code in PR #3441:
URL: https://github.com/apache/incubator-shenyu/pull/3441#discussion_r884196798


##########
shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceBeanPostProcessor.java:
##########
@@ -104,18 +110,41 @@ private void handler(final ServiceFactoryBean 
serviceBean) {
         if (AopUtils.isAopProxy(targetProxy)) {
             clazz = AopUtils.getTargetClass(targetProxy);
         }
+        final ShenyuSofaClient shenyuSofaClient = 
AnnotationUtils.findAnnotation(clazz, ShenyuSofaClient.class);
+        final String superPath = buildApiSuperPath(shenyuSofaClient);
+        if (superPath.contains("*")) {
+            Method[] declaredMethods = 
ReflectionUtils.getDeclaredMethods(clazz);
+            for (Method declaredMethod : declaredMethods) {
+                if (Objects.nonNull(shenyuSofaClient)) {
+                    publisher.publishEvent(buildMetaDataDTO(serviceBean, 
shenyuSofaClient, declaredMethod, superPath));
+                }
+            }
+            return;
+        }
         Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
         for (Method method : methods) {
-            ShenyuSofaClient shenyuSofaClient = 
method.getAnnotation(ShenyuSofaClient.class);
-            if (Objects.nonNull(shenyuSofaClient)) {
-                publisher.publishEvent(buildMetaDataDTO(serviceBean, 
shenyuSofaClient, method));
+            ShenyuSofaClient shenyuSofaClientAnnotation = 
method.getAnnotation(ShenyuSofaClient.class);
+            if (Objects.nonNull(shenyuSofaClientAnnotation)) {
+                publisher.publishEvent(buildMetaDataDTO(serviceBean, 
shenyuSofaClientAnnotation, method, superPath));
             }
         }
     }
 
-    private MetaDataRegisterDTO buildMetaDataDTO(final ServiceFactoryBean 
serviceBean, final ShenyuSofaClient shenyuSofaClient, final Method method) {
+    private String buildApiSuperPath(final ShenyuSofaClient shenyuSofaClient) {
+        if (Objects.nonNull(shenyuSofaClient) && 
!StringUtils.isBlank(shenyuSofaClient.path())) {
+            return shenyuSofaClient.path();
+        }
+        return "";
+    }
+
+    private MetaDataRegisterDTO buildMetaDataDTO(final ServiceFactoryBean 
serviceBean, final ShenyuSofaClient shenyuSofaClient, final Method method, 
final String superPath) {
         String appName = this.appName;
-        String path = contextPath + shenyuSofaClient.path();
+        String path;
+        if (superPath.contains("*")) {

Review Comment:
   superPath will not contains("*") anymore, it had been solved in 
`handler(ServiceFactoryBean)`, so how about remove it ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to