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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]