You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by zh...@apache.org on 2022/06/20 03:47:59 UTC

[incubator-shenyu] branch master updated: tars client lossless registration #3848 (#3582)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 79b5a90e2  tars client lossless registration #3848 (#3582)
79b5a90e2 is described below

commit 79b5a90e2086d27b337750e2cf242fef898b3b33
Author: chuang <49...@users.noreply.github.com>
AuthorDate: Mon Jun 20 11:47:54 2022 +0800

     tars client lossless registration #3848 (#3582)
    
    * [ISSUE #2679] Add integration test for RequestControllerTest
    Add integration test for ShenyuClientPathControllerTest
    Add @ShenyuSpringMvcClient to ShenyuClientPathController
    
    * #3486 SofaService buildMetaData path question
    
     SofaService buildMetaData path  use only once
    
    * add the logic of annotation on the splicing class for tars client
    
    add the logic of annotation on the splicing class for tars client
    
    * [ISSUE #3484] fix spring mvc client lossless registration
    
    [ISSUE #3484] fix spring mvc client lossless registration
    
    * tars client lossless registration #3484
    
    tars client lossless registration #3484
    
    * [Task] add AOP for almost all examples
    
    [Task] add AOP for almost all examples spring mvc
    
    * [Task] add AOP for almost all examples #3523
---
 shenyu-client/shenyu-client-tars/pom.xml           |  5 ++
 ...ssor.java => TarsServiceBeanEventListener.java} | 53 ++++++++---------
 .../tars/TarsServiceBeanPostProcessorTest.java     | 69 +++++++++++++++-------
 shenyu-examples/pom.xml                            |  1 +
 .../shenyu-examples-springmvc-tomcat/pom.xml       |  5 ++
 .../springmvc/controller/HttpTestController.java   | 17 +++---
 shenyu-examples/shenyu-examples-springmvc/pom.xml  |  6 ++
 .../springmvc/controller/HttpTestController.java   | 17 +++---
 .../client/tars/ShenyuTarsClientConfiguration.java | 12 ++--
 .../tars/ShenyuTarsClientConfigurationTest.java    |  6 +-
 10 files changed, 118 insertions(+), 73 deletions(-)

diff --git a/shenyu-client/shenyu-client-tars/pom.xml b/shenyu-client/shenyu-client-tars/pom.xml
index 550194625..0274ba12b 100644
--- a/shenyu-client/shenyu-client-tars/pom.xml
+++ b/shenyu-client/shenyu-client-tars/pom.xml
@@ -59,5 +59,10 @@
             </exclusions>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-test</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java
similarity index 85%
rename from shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java
rename to shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java
index 2efba87af..0b61514ea 100644
--- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessor.java
+++ b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java
@@ -33,8 +33,8 @@ import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository;
 import org.apache.shenyu.register.common.config.PropertiesConfig;
 import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO;
 import org.springframework.aop.support.AopUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
 import org.springframework.core.annotation.AnnotatedElementUtils;
 import org.springframework.lang.NonNull;
@@ -46,12 +46,13 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 import java.util.Properties;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
- * The Tars ServiceBean PostProcessor.
+ * The Tars ServiceBean EventListener.
  */
-public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
+public class TarsServiceBeanEventListener implements ApplicationListener<ContextRefreshedEvent> {
 
     private final LocalVariableTableParameterNameDiscoverer localVariableTableParameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
 
@@ -65,7 +66,7 @@ public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
 
     private final int port;
 
-    public TarsServiceBeanPostProcessor(final PropertiesConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {
+    public TarsServiceBeanEventListener(final PropertiesConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {
         Properties props = clientConfig.getProps();
         String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH);
         this.host = props.getProperty(ShenyuClientConstants.HOST);
@@ -80,15 +81,11 @@ public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
     }
 
     @Override
-    public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
-        Class clazz = bean.getClass();
-        if (AopUtils.isAopProxy(clazz)) {
-            clazz = AopUtils.getTargetClass(clazz);
+    public void onApplicationEvent(final ContextRefreshedEvent event) {
+        Map<String, Object> controllerBeans = event.getApplicationContext().getBeansWithAnnotation(ShenyuTarsService.class);
+        for (Map.Entry<String, Object> entry : controllerBeans.entrySet()) {
+            handler(entry.getValue());
         }
-        if (AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuTarsService.class) != null) {
-            handler(bean);
-        }
-        return bean;
     }
 
     private void handler(final Object serviceBean) {
@@ -132,22 +129,22 @@ public class TarsServiceBeanPostProcessor implements BeanPostProcessor {
         String methodName = method.getName();
         Class<?>[] parameterTypesClazz = method.getParameterTypes();
         String parameterTypes = Arrays.stream(parameterTypesClazz).map(Class::getName)
-                .collect(Collectors.joining(","));
+            .collect(Collectors.joining(","));
         return MetaDataRegisterDTO.builder()
-                .appName(ipAndPort)
-                .serviceName(serviceName)
-                .methodName(methodName)
-                .contextPath(this.contextPath)
-                .path(path)
-                .host(host)
-                .port(port)
-                .ruleName(ruleName)
-                .pathDesc(desc)
-                .parameterTypes(parameterTypes)
-                .rpcType(RpcTypeEnum.TARS.getName())
-                .rpcExt(rpcExt)
-                .enabled(shenyuTarsClient.enabled())
-                .build();
+            .appName(ipAndPort)
+            .serviceName(serviceName)
+            .methodName(methodName)
+            .contextPath(this.contextPath)
+            .path(path)
+            .host(host)
+            .port(port)
+            .ruleName(ruleName)
+            .pathDesc(desc)
+            .parameterTypes(parameterTypes)
+            .rpcType(RpcTypeEnum.TARS.getName())
+            .rpcExt(rpcExt)
+            .enabled(shenyuTarsClient.enabled())
+            .build();
     }
 
     private String pathJoin(@NonNull final String... path) {
diff --git a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java
index a95b7875e..edc60e0ec 100644
--- a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java
+++ b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java
@@ -24,37 +24,77 @@ import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService;
 import org.apache.shenyu.register.client.http.utils.RegisterUtils;
 import org.apache.shenyu.register.common.config.PropertiesConfig;
 import org.apache.shenyu.register.common.config.ShenyuRegisterCenterConfig;
-import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.MethodOrderer;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestMethodOrder;
 import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
 import org.mockito.MockedStatic;
 import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.event.ContextRefreshedEvent;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
- * Test case for {@link TarsServiceBeanPostProcessor}.
+ * Test case for {@link TarsServiceBeanEventListener}.
  */
 @ExtendWith(MockitoExtension.class)
 @TestMethodOrder(MethodOrderer.Alphanumeric.class)
 public final class TarsServiceBeanPostProcessorTest {
-    private static TarsServiceBeanPostProcessor tarsServiceBeanPostProcessor;
+    private final MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
 
-    @BeforeAll
-    public static void init() {
+    private final TarsDemoService tarsDemoService = new TarsDemoService();
+
+    @Mock
+    private ApplicationContext applicationContext;
+
+    private ContextRefreshedEvent contextRefreshedEvent;
+
+    @BeforeEach
+    public void init() {
+        Map<String, Object> results = new LinkedHashMap();
+        results.put("tarsDemoService", tarsDemoService);
+        when(applicationContext.getBeansWithAnnotation(any())).thenReturn(results);
+        contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
+
+    }
+
+    @Test
+    public void testPostProcessAfterInitialization() {
+        registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
+        TarsServiceBeanEventListener tarsServiceBeanEventListener = buildTarsServiceBeanEventListener(true);
+        tarsServiceBeanEventListener.onApplicationEvent(contextRefreshedEvent);
+        verify(applicationContext, times(1)).getBeansWithAnnotation(any());
+        registerUtilsMockedStatic.close();
+    }
+
+    @Test
+    public void testPostProcessNormalBean() {
+        registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
+        TarsServiceBeanEventListener tarsServiceBeanEventListener = buildTarsServiceBeanEventListener(false);
+        tarsServiceBeanEventListener.onApplicationEvent(contextRefreshedEvent);
+        verify(applicationContext, times(1)).getBeansWithAnnotation(any());
+        registerUtilsMockedStatic.close();
+    }
+
+    private TarsServiceBeanEventListener buildTarsServiceBeanEventListener(final boolean full) {
         Properties properties = new Properties();
         properties.setProperty("contextPath", "/tars");
         properties.setProperty("port", "8080");
         properties.setProperty("host", "localhost");
         properties.setProperty("username", "admin");
         properties.setProperty("password", "123456");
-
         PropertiesConfig config = new PropertiesConfig();
         config.setProps(properties);
 
@@ -62,23 +102,8 @@ public final class TarsServiceBeanPostProcessorTest {
         mockRegisterCenter.setServerLists("http://localhost:58080");
         mockRegisterCenter.setRegisterType("http");
         mockRegisterCenter.setProps(properties);
-        MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
-        registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
-        tarsServiceBeanPostProcessor = new TarsServiceBeanPostProcessor(config, ShenyuClientRegisterRepositoryFactory.newInstance(mockRegisterCenter));
-        registerUtilsMockedStatic.close();
-    }
 
-    @Test
-    public void testPostProcessAfterInitialization() {
-        TarsDemoService serviceFactoryBean = new TarsDemoService();
-        tarsServiceBeanPostProcessor
-                .postProcessAfterInitialization(serviceFactoryBean, "ShenyuTarsTest");
-    }
-
-    @Test
-    public void testPostProcessNormalBean() {
-        tarsServiceBeanPostProcessor
-                .postProcessAfterInitialization(new Object(), "normalBean");
+        return new TarsServiceBeanEventListener(config, ShenyuClientRegisterRepositoryFactory.newInstance(mockRegisterCenter));
     }
 
     @ShenyuTarsService(serviceName = "testObj")
diff --git a/shenyu-examples/pom.xml b/shenyu-examples/pom.xml
index 7863c50ed..bfb6d9da5 100644
--- a/shenyu-examples/pom.xml
+++ b/shenyu-examples/pom.xml
@@ -52,6 +52,7 @@
         <module>shenyu-examples-motan</module>
         <module>shenyu-examples-plugin</module>
         <module>shenyu-examples-websocket</module>
+        <module>shenyu-examples-springmvc</module>
         <module>shenyu-examples-springmvc-tomcat</module>
     </modules>
 
diff --git a/shenyu-examples/shenyu-examples-springmvc-tomcat/pom.xml b/shenyu-examples/shenyu-examples-springmvc-tomcat/pom.xml
index afec174a3..03a1d8349 100644
--- a/shenyu-examples/shenyu-examples-springmvc-tomcat/pom.xml
+++ b/shenyu-examples/shenyu-examples-springmvc-tomcat/pom.xml
@@ -50,6 +50,11 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-examples-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/shenyu-examples/shenyu-examples-springmvc-tomcat/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java b/shenyu-examples/shenyu-examples-springmvc-tomcat/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
index dc13ce0bc..553de52d3 100644
--- a/shenyu-examples/shenyu-examples-springmvc-tomcat/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
+++ b/shenyu-examples/shenyu-examples-springmvc-tomcat/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
@@ -19,7 +19,9 @@ package org.apache.shenyu.examples.springmvc.controller;
 
 import java.util.HashMap;
 import java.util.Map;
+
 import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient;
+import org.apache.shenyu.examples.common.aop.Log;
 import org.apache.shenyu.examples.springmvc.dto.UserDTO;
 import org.apache.shenyu.examples.springmvc.result.ResultBean;
 import org.springframework.web.bind.annotation.CookieValue;
@@ -60,26 +62,26 @@ public class HttpTestController {
      */
     @GetMapping("/findByUserId")
     public UserDTO findByUserId(@RequestParam("userId") final String userId) {
-        return buildUser(userId,"hello world");
+        return buildUser(userId, "hello world");
     }
 
     /**
      * Find by page user dto.
      *
-     * @param keyword the keyword
-     * @param page the page
+     * @param keyword  the keyword
+     * @param page     the page
      * @param pageSize the page size
      * @return the user dto
      */
     @GetMapping("/findByPage")
     public UserDTO findByPage(final String keyword, final Integer page, final Integer pageSize) {
-        return buildUser(keyword,"hello world keyword is" + keyword + " page is" + page + " pageSize is" + pageSize);
+        return buildUser(keyword, "hello world keyword is" + keyword + " page is" + page + " pageSize is" + pageSize);
     }
 
     /**
      * Gets path variable.
      *
-     * @param id the id
+     * @param id   the id
      * @param name the name
      * @return the path variable
      */
@@ -95,16 +97,17 @@ public class HttpTestController {
      * @param id the id
      * @return the string
      */
+    @Log
     @GetMapping("/path/{id}/name")
     public UserDTO testRestFul(@PathVariable("id") final String id) {
-        return buildUser(id,"hello world");
+        return buildUser(id, "hello world");
     }
 
 
     /**
      * Put path variable and body string.
      *
-     * @param id the id
+     * @param id      the id
      * @param userDTO the user dto
      * @return the string
      */
diff --git a/shenyu-examples/shenyu-examples-springmvc/pom.xml b/shenyu-examples/shenyu-examples-springmvc/pom.xml
index 007c73ea7..d16d488c6 100644
--- a/shenyu-examples/shenyu-examples-springmvc/pom.xml
+++ b/shenyu-examples/shenyu-examples-springmvc/pom.xml
@@ -44,6 +44,12 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-examples-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/shenyu-examples/shenyu-examples-springmvc/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java b/shenyu-examples/shenyu-examples-springmvc/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
index b6bb4449f..d29e91ed9 100644
--- a/shenyu-examples/shenyu-examples-springmvc/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
+++ b/shenyu-examples/shenyu-examples-springmvc/src/main/java/org/apache/shenyu/examples/springmvc/controller/HttpTestController.java
@@ -19,7 +19,9 @@ package org.apache.shenyu.examples.springmvc.controller;
 
 import java.util.HashMap;
 import java.util.Map;
+
 import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient;
+import org.apache.shenyu.examples.common.aop.Log;
 import org.apache.shenyu.examples.springmvc.dto.UserDTO;
 import org.apache.shenyu.examples.springmvc.result.ResultBean;
 import org.springframework.web.bind.annotation.CookieValue;
@@ -60,26 +62,26 @@ public class HttpTestController {
      */
     @GetMapping("/findByUserId")
     public UserDTO findByUserId(@RequestParam("userId") final String userId) {
-        return buildUser(userId,"hello world");
+        return buildUser(userId, "hello world");
     }
 
     /**
      * Find by page user dto.
      *
-     * @param keyword the keyword
-     * @param page the page
+     * @param keyword  the keyword
+     * @param page     the page
      * @param pageSize the page size
      * @return the user dto
      */
     @GetMapping("/findByPage")
     public UserDTO findByPage(final String keyword, final Integer page, final Integer pageSize) {
-        return buildUser(keyword,"hello world keyword is" + keyword + " page is" + page + " pageSize is" + pageSize);
+        return buildUser(keyword, "hello world keyword is" + keyword + " page is" + page + " pageSize is" + pageSize);
     }
 
     /**
      * Gets path variable.
      *
-     * @param id the id
+     * @param id   the id
      * @param name the name
      * @return the path variable
      */
@@ -95,16 +97,17 @@ public class HttpTestController {
      * @param id the id
      * @return the string
      */
+    @Log
     @GetMapping("/path/{id}/name")
     public UserDTO testRestFul(@PathVariable("id") final String id) {
-        return buildUser(id,"hello world");
+        return buildUser(id, "hello world");
     }
 
 
     /**
      * Put path variable and body string.
      *
-     * @param id the id
+     * @param id      the id
      * @param userDTO the user dto
      * @return the string
      */
diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java
index b1e1694bb..5d8c4ba43 100644
--- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java
+++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java
@@ -19,7 +19,7 @@
 package org.apache.shenyu.springboot.starter.client.tars;
 
 import org.apache.shenyu.client.tars.TarsContextRefreshedEventListener;
-import org.apache.shenyu.client.tars.TarsServiceBeanPostProcessor;
+import org.apache.shenyu.client.tars.TarsServiceBeanEventListener;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
 import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository;
 import org.apache.shenyu.register.common.config.ShenyuClientConfig;
@@ -34,19 +34,19 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 @ImportAutoConfiguration(ShenyuClientCommonBeanConfiguration.class)
 public class ShenyuTarsClientConfiguration {
-    
+
     /**
      * Tars service bean post processor.
      *
-     * @param clientConfig the client config
+     * @param clientConfig                   the client config
      * @param shenyuClientRegisterRepository the shenyuClientRegisterRepository
      * @return the tars service bean post processor
      */
     @Bean
-    public TarsServiceBeanPostProcessor tarsServiceBeanPostProcessor(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {
-        return new TarsServiceBeanPostProcessor(clientConfig.getClient().get(RpcTypeEnum.TARS.getName()), shenyuClientRegisterRepository);
+    public TarsServiceBeanEventListener tarsServiceBeanEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {
+        return new TarsServiceBeanEventListener(clientConfig.getClient().get(RpcTypeEnum.TARS.getName()), shenyuClientRegisterRepository);
     }
-    
+
     /**
      * Tars context refreshed event listener.
      *
diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java
index 1ee037beb..d78675fb7 100644
--- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java
+++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java
@@ -19,7 +19,7 @@
 package org.apache.shenyu.springboot.starter.client.tars;
 
 import org.apache.shenyu.client.tars.TarsContextRefreshedEventListener;
-import org.apache.shenyu.client.tars.TarsServiceBeanPostProcessor;
+import org.apache.shenyu.client.tars.TarsServiceBeanEventListener;
 import org.apache.shenyu.register.client.http.utils.RegisterUtils;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -67,8 +67,8 @@ public class ShenyuTarsClientConfigurationTest {
         MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.ofNullable("token"));
         applicationContextRunner.run(context -> {
-            TarsServiceBeanPostProcessor processor = context.getBean("tarsServiceBeanPostProcessor", TarsServiceBeanPostProcessor.class);
-            assertNotNull(processor);
+            TarsServiceBeanEventListener listener = context.getBean("tarsServiceBeanEventListener", TarsServiceBeanEventListener.class);
+            assertNotNull(listener);
         });
         registerUtilsMockedStatic.close();
     }