diff --git a/core/pom.xml b/core/pom.xml index f6990581..625b45c4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -19,7 +19,7 @@ 0.31.1 2.7.4 1.2.3 - 2.8.6 + 2.8.9 diff --git a/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/server/apps/SpringBootAppContext.java b/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/server/apps/SpringBootAppContext.java index f7d671d3..c4834a70 100644 --- a/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/server/apps/SpringBootAppContext.java +++ b/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/server/apps/SpringBootAppContext.java @@ -31,7 +31,7 @@ import com.qq.tars.spring.annotation.TarsServant; import org.springframework.aop.framework.Advised; import org.springframework.context.ApplicationContext; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import java.util.Map; @@ -93,7 +93,7 @@ private ServantHomeSkeleton loadServant(Object bean) throws Exception { ServerConfig serverCfg = ConfigurationManager.getInstance().getServerConfig(); - homeName = AnnotationUtils.getAnnotation(bean.getClass(), TarsServant.class).name(); + homeName = AnnotatedElementUtils.findMergedAnnotation(bean.getClass(), TarsServant.class).name(); if (StringUtils.isEmpty(homeName)) { throw new RuntimeException("servant name is null."); } diff --git a/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/spring/bean/CommunicatorBeanPostProcessor.java b/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/spring/bean/CommunicatorBeanPostProcessor.java index 6c468aac..0e9b840b 100644 --- a/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/spring/bean/CommunicatorBeanPostProcessor.java +++ b/spring/tars-spring-boot-starter/src/main/java/com/qq/tars/spring/bean/CommunicatorBeanPostProcessor.java @@ -25,7 +25,7 @@ import com.qq.tars.spring.annotation.TarsClient; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.util.ReflectionUtils; import java.lang.reflect.Field; @@ -51,7 +51,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw private void processFields(Object bean, Field[] declaredFields) { for (Field field : declaredFields) { - TarsClient annotation = AnnotationUtils.getAnnotation(field, TarsClient.class); + TarsClient annotation = AnnotatedElementUtils.findMergedAnnotation(field, TarsClient.class); if (annotation == null) { continue; } diff --git a/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/server/apps/TarsStartLifecycle.java b/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/server/apps/TarsStartLifecycle.java index fe947f6c..d8027829 100644 --- a/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/server/apps/TarsStartLifecycle.java +++ b/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/server/apps/TarsStartLifecycle.java @@ -36,6 +36,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.SmartLifecycle; +import org.springframework.core.annotation.AnnotatedElementUtils; import java.io.IOException; import java.util.LinkedHashMap; @@ -152,7 +153,7 @@ private ServantHomeSkeleton loadServant(Object bean) throws Exception { ServerConfig serverCfg = ConfigurationManager.getInstance().getServerConfig(); - homeName = bean.getClass().getAnnotation(TarsServant.class).name(); + homeName = AnnotatedElementUtils.findMergedAnnotation(bean.getClass(), TarsServant.class).name(); if (StringUtils.isEmpty(homeName)) { throw new RuntimeException("servant name is null."); } diff --git a/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/spring/bean/TarsClientBeanPostProcessor.java b/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/spring/bean/TarsClientBeanPostProcessor.java index d7430f27..8f1f785c 100644 --- a/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/spring/bean/TarsClientBeanPostProcessor.java +++ b/spring/tars-spring-cloud-starter/src/main/java/com/qq/tars/spring/bean/TarsClientBeanPostProcessor.java @@ -34,7 +34,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.util.ReflectionUtils; import java.lang.reflect.Field; @@ -75,7 +75,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw private void processFields(Object bean, Field[] declaredFields) { for (Field field : declaredFields) { - TarsClient annotation = AnnotationUtils.getAnnotation(field, TarsClient.class); + TarsClient annotation = AnnotatedElementUtils.findMergedAnnotation(field, TarsClient.class); if (annotation == null) { continue; }