From 598395c81fc76c6ae3b16f60ad72ea9720c17839 Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Wed, 9 Aug 2023 15:10:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=B0=81=E8=A3=85=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=EF=BC=8C=E6=94=AF=E6=8C=81spring5=E5=85=A8?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyfish/rest/registry/proxy/entity/RestMethod.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rest-proxy-core/src/main/java/group/flyfish/rest/registry/proxy/entity/RestMethod.java b/rest-proxy-core/src/main/java/group/flyfish/rest/registry/proxy/entity/RestMethod.java index acb820d..66869e5 100644 --- a/rest-proxy-core/src/main/java/group/flyfish/rest/registry/proxy/entity/RestMethod.java +++ b/rest-proxy-core/src/main/java/group/flyfish/rest/registry/proxy/entity/RestMethod.java @@ -5,9 +5,8 @@ import group.flyfish.rest.enums.HttpMethod; import group.flyfish.rest.registry.proxy.RestProxyInvoker; import group.flyfish.rest.utils.DataUtils; import lombok.Getter; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.core.annotation.MergedAnnotation; -import org.springframework.core.annotation.MergedAnnotations; import java.beans.Transient; import java.lang.reflect.Method; @@ -77,13 +76,12 @@ public class RestMethod { * 初始化方法 */ private void init(Method method, RestProxyInvoker invoker) { - MergedAnnotation annotation = MergedAnnotations.from(method).get(RestApi.class); + RestApi restApi = AnnotatedElementUtils.findMergedAnnotation(method, RestApi.class); // 无视proxy,因为啥也没 - if (!annotation.isPresent()) { + if (null == restApi) { this.invalid = true; return; } - RestApi restApi = annotation.synthesize(); this.url = determineUrl(restApi, invoker); this.method = restApi.method(); this.credentials = restApi.credentials();