You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/09 04:45:06 UTC

[GitHub] [incubator-shenyu] weihubeats opened a new pull request, #3505: update ShenyuGrpcClient

weihubeats opened a new pull request, #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505

   https://github.com/apache/incubator-shenyu/issues/3485


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894193368


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   > I've dealt with it, take a look
   
   you mean this ?
   ```java
           Class<?> clazz;
           try {
               clazz = serviceBean.getClass();
           } catch (Exception e) {
               LOG.error("failed to get grpc target class", e);
               return;
           }
           Class<?> parent = clazz.getSuperclass();
           Class<?> classes = parent.getDeclaringClass();
           String packageName;
           try {
               String serviceName = ShenyuClientConstants.SERVICE_NAME;
               Field field = classes.getField(serviceName);
               field.setAccessible(true);
               packageName = field.get(null).toString();
           } catch (Exception e) {
               LOG.error(String.format("SERVICE_NAME field not found: %s", classes), e);
               return;
           }
   ```



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894190176


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,21 +125,22 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
-        String basePath = Optional.ofNullable(grpcClassAnnotation)
-                .map(annotation -> StringUtils.defaultIfBlank(grpcClassAnnotation.path(), "")).orElse("");
+        ShenyuGrpcClient beanShenyuClient = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);
+        String basePath = Optional.ofNullable(beanShenyuClient)
+                .map(annotation -> StringUtils.defaultIfBlank(beanShenyuClient.path(), "")).orElse("");
         if (basePath.contains("*")) {
             Method[] methods = ReflectionUtils.getDeclaredMethods(clazz);
             for (Method method : methods) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClassAnnotation, method, basePath));
+                publisher.publishEvent(buildMetaDataDTO(packageName, beanShenyuClient, method, basePath));
             }
             return;
         }
         final Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
         for (Method method : methods) {
-            ShenyuGrpcClient grpcClient = method.getAnnotation(ShenyuGrpcClient.class);
-            if (Objects.nonNull(grpcClient)) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClient, method, basePath));
+            ShenyuGrpcClient methodShenyuClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuGrpcClient.class);
+            methodShenyuClient = Objects.isNull(methodShenyuClient) ? beanShenyuClient : methodShenyuClient;

Review Comment:
   please remove `methodShenyuClient = Objects.isNull(methodShenyuClient) ? beanShenyuClient : methodShenyuClient;`



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] codecov-commenter commented on pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#issuecomment-1150744664

   # [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3505](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6a4afc8) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/958c8efc31d28fa6f8c3c71b69103184df16ed83?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (958c8ef) will **decrease** coverage by `0.36%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3505      +/-   ##
   ============================================
   - Coverage     62.84%   62.48%   -0.37%     
   + Complexity     5563     5529      -34     
   ============================================
     Files           841      841              
     Lines         23296    23288       -8     
     Branches       2114     2111       -3     
   ============================================
   - Hits          14640    14551      -89     
   - Misses         7309     7385      +76     
   - Partials       1347     1352       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
   | [...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jYWNoZS9HcnBjQ2xpZW50Q2FjaGUuamF2YQ==) | `75.00% <0.00%> (-25.00%)` | :arrow_down: |
   | [...controller/ShenyuClientHttpRegistryController.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vY29udHJvbGxlci9TaGVueXVDbGllbnRIdHRwUmVnaXN0cnlDb250cm9sbGVyLmphdmE=) | `77.77% <0.00%> (-22.23%)` | :arrow_down: |
   | [...ogging/rocketmq/body/LoggingServerHttpRequest.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvYm9keS9Mb2dnaW5nU2VydmVySHR0cFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [...ruptor/RegisterClientServerDisruptorPublisher.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vZGlzcnVwdG9yL1JlZ2lzdGVyQ2xpZW50U2VydmVyRGlzcnVwdG9yUHVibGlzaGVyLmphdmE=) | `52.94% <0.00%> (-11.77%)` | :arrow_down: |
   | [...a/org/apache/shenyu/common/utils/VersionUtils.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi91dGlscy9WZXJzaW9uVXRpbHMuamF2YQ==) | `67.85% <0.00%> (-10.72%)` | :arrow_down: |
   | [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `54.25% <0.00%> (-9.58%)` | :arrow_down: |
   | [.../apache/shenyu/admin/model/dto/BatchCommonDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0JhdGNoQ29tbW9uRFRPLmphdmE=) | `50.00% <0.00%> (-7.15%)` | :arrow_down: |
   | [...apache/shenyu/admin/model/dto/AuthPathWarpDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoV2FycERUTy5qYXZh) | `57.14% <0.00%> (-7.15%)` | :arrow_down: |
   | [...org/apache/shenyu/admin/model/dto/AuthPathDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoRFRPLmphdmE=) | `58.82% <0.00%> (-5.89%)` | :arrow_down: |
   | ... and [37 more](https://codecov.io/gh/apache/incubator-shenyu/pull/3505/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [958c8ef...6a4afc8](https://codecov.io/gh/apache/incubator-shenyu/pull/3505?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] weihubeats commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
weihubeats commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894102301


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   I've dealt with it, take a look



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] weihubeats commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
weihubeats commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894208235


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,21 +125,22 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
-        String basePath = Optional.ofNullable(grpcClassAnnotation)
-                .map(annotation -> StringUtils.defaultIfBlank(grpcClassAnnotation.path(), "")).orElse("");
+        ShenyuGrpcClient beanShenyuClient = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);
+        String basePath = Optional.ofNullable(beanShenyuClient)
+                .map(annotation -> StringUtils.defaultIfBlank(beanShenyuClient.path(), "")).orElse("");
         if (basePath.contains("*")) {
             Method[] methods = ReflectionUtils.getDeclaredMethods(clazz);
             for (Method method : methods) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClassAnnotation, method, basePath));
+                publisher.publishEvent(buildMetaDataDTO(packageName, beanShenyuClient, method, basePath));
             }
             return;
         }
         final Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
         for (Method method : methods) {
-            ShenyuGrpcClient grpcClient = method.getAnnotation(ShenyuGrpcClient.class);
-            if (Objects.nonNull(grpcClient)) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClient, method, basePath));
+            ShenyuGrpcClient methodShenyuClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuGrpcClient.class);
+            methodShenyuClient = Objects.isNull(methodShenyuClient) ? beanShenyuClient : methodShenyuClient;

Review Comment:
   I deleted the get class annotation, sick get aop class



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang merged pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang merged PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#issuecomment-1151288894

   It is recommended to add AOP tests like `shenyu-examples-tars`.


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r893503372


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   When the user uses AOP, can it work normally?



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] weihubeats commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
weihubeats commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894102184


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   If the annotation on the method is empty, get the annotation on the class?



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894219048


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,21 +125,22 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
-        String basePath = Optional.ofNullable(grpcClassAnnotation)
-                .map(annotation -> StringUtils.defaultIfBlank(grpcClassAnnotation.path(), "")).orElse("");
+        ShenyuGrpcClient beanShenyuClient = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);
+        String basePath = Optional.ofNullable(beanShenyuClient)
+                .map(annotation -> StringUtils.defaultIfBlank(beanShenyuClient.path(), "")).orElse("");
         if (basePath.contains("*")) {
             Method[] methods = ReflectionUtils.getDeclaredMethods(clazz);
             for (Method method : methods) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClassAnnotation, method, basePath));
+                publisher.publishEvent(buildMetaDataDTO(packageName, beanShenyuClient, method, basePath));
             }
             return;
         }
         final Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz);
         for (Method method : methods) {
-            ShenyuGrpcClient grpcClient = method.getAnnotation(ShenyuGrpcClient.class);
-            if (Objects.nonNull(grpcClient)) {
-                publisher.publishEvent(buildMetaDataDTO(packageName, grpcClient, method, basePath));
+            ShenyuGrpcClient methodShenyuClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuGrpcClient.class);
+            methodShenyuClient = Objects.isNull(methodShenyuClient) ? beanShenyuClient : methodShenyuClient;

Review Comment:
   > I deleted the get class annotation, sick get aop class
   
   Nice work, this PR will be merged after CI/CD passed.



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r894192333


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   > If the annotation on the method is empty, get the annotation on the class?
   
   no



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#issuecomment-1152081215

   @weihubeats please add wechat Z18179469818


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3505: update ShenyuGrpcClient

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3505:
URL: https://github.com/apache/incubator-shenyu/pull/3505#discussion_r893621783


##########
shenyu-client/shenyu-client-grpc/src/main/java/org/apache/shenyu/client/grpc/GrpcClientBeanPostProcessor.java:
##########
@@ -125,7 +125,7 @@ private void handler(final Object serviceBean) {
             LOG.error(String.format("grpc SERVICE_NAME can not found: %s", classes));
             return;
         }
-        ShenyuGrpcClient grpcClassAnnotation = AnnotationUtils.findAnnotation(clazz, ShenyuGrpcClient.class);
+        ShenyuGrpcClient grpcClassAnnotation = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuGrpcClient.class);

Review Comment:
   `AnnotationUtils#findAnnotation` can be compatible with AOP, but `AnnotatedElementUtils#findMergedAnnotation` will not.



-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org