This is an automated email from the ASF dual-hosted git repository.

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new c471902da6 fix(client): enable annotation register processors (#7077)
c471902da6 is described below

commit c471902da6c8a24756bc02c7020e88a14cb0f61b
Author: Liming Deng <[email protected]>
AuthorDate: Wed Sep 30 09:57:00 2026 +0800

    fix(client): enable annotation register processors (#7077)
---
 .../matcher/BaseAnnotationApiProcessor.java        |  4 +-
 .../matcher/BaseAnnotationApiProcessorTest.java    | 80 ++++++++++++++++++++++
 2 files changed, 82 insertions(+), 2 deletions(-)

diff --git 
a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessor.java
 
b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessor.java
index 266a5914f4..84ed41124b 100644
--- 
a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessor.java
+++ 
b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessor.java
@@ -44,7 +44,7 @@ public abstract class BaseAnnotationApiProcessor<T extends 
Annotation> implement
     
     @Override
     public boolean match(final ApiBean element) {
-        return false;
+        return true;
     }
     
     /**
@@ -54,6 +54,6 @@ public abstract class BaseAnnotationApiProcessor<T extends 
Annotation> implement
      * @return true
      */
     public boolean match(final ApiBean.ApiDefinition definition) {
-        return false;
+        return true;
     }
 }
diff --git 
a/shenyu-client/shenyu-client-core/src/test/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessorTest.java
 
b/shenyu-client/shenyu-client-core/src/test/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessorTest.java
new file mode 100644
index 0000000000..0d9359d138
--- /dev/null
+++ 
b/shenyu-client/shenyu-client-core/src/test/java/org/apache/shenyu/client/core/register/matcher/BaseAnnotationApiProcessorTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.client.core.register.matcher;
+
+import org.apache.shenyu.client.core.register.ApiBean;
+import org.junit.jupiter.api.Test;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Test cases for {@link BaseAnnotationApiProcessor}.
+ */
+public final class BaseAnnotationApiProcessorTest {
+
+    @Test
+    public void testProcessesMatchingAnnotationsByDefault() throws 
NoSuchMethodException {
+        Method method = AnnotatedService.class.getDeclaredMethod("call");
+        ApiBean.ApiDefinition definition = new ApiBean.ApiDefinition(method);
+        ApiBean apiBean = new ApiBean("test", "annotatedService", new 
AnnotatedService(), Collections.singletonList(definition));
+        AtomicInteger beanInvocations = new AtomicInteger();
+        AtomicInteger definitionInvocations = new AtomicInteger();
+        BaseAnnotationApiProcessor<Marker> processor = new 
BaseAnnotationApiProcessor<Marker>() {
+            @Override
+            public void process(final ApiBean target, final Marker annotation) 
{
+                beanInvocations.incrementAndGet();
+            }
+
+            @Override
+            public void process(final ApiBean.ApiDefinition target, final 
Marker annotation) {
+                definitionInvocations.incrementAndGet();
+            }
+
+            @Override
+            public Class<Marker> matchAnnotation() {
+                return Marker.class;
+            }
+        };
+
+        processor.process(apiBean);
+
+        assertEquals(1, beanInvocations.get());
+        assertEquals(1, definitionInvocations.get());
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.METHOD})
+    private @interface Marker {
+    }
+
+    @Marker
+    private static final class AnnotatedService {
+
+        @Marker
+        public void call() {
+        }
+    }
+}

Reply via email to