feat: 增加加载感知类

This commit is contained in:
wangyu 2023-07-19 17:19:47 +08:00
parent 17adfebe5b
commit ea51622604
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import group.flyfish.rest.registry.proxy.RestProxyInvoker;
import group.flyfish.rest.utils.DataUtils; import group.flyfish.rest.utils.DataUtils;
import lombok.Getter; import lombok.Getter;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.annotation.MergedAnnotations;
import java.beans.Transient; import java.beans.Transient;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -75,12 +77,13 @@ public class RestMethod {
* 初始化方法 * 初始化方法
*/ */
private void init(Method method, RestProxyInvoker invoker) { private void init(Method method, RestProxyInvoker invoker) {
RestApi restApi = AnnotationUtils.findAnnotation(method, RestApi.class); MergedAnnotation<RestApi> annotation = MergedAnnotations.from(method).get(RestApi.class);
// 无视proxy因为啥也没 // 无视proxy因为啥也没
if (null == restApi) { if (!annotation.isPresent()) {
this.invalid = true; this.invalid = true;
return; return;
} }
RestApi restApi = annotation.synthesize();
this.url = determineUrl(restApi, invoker); this.url = determineUrl(restApi, invoker);
this.method = restApi.method(); this.method = restApi.method();
this.credentials = restApi.credentials(); this.credentials = restApi.credentials();