fix: 修复嵌套注解无法找到的问题

This commit is contained in:
wangyu 2024-03-26 22:51:47 +08:00
parent 329e258846
commit e5f55d78b3
4 changed files with 7 additions and 5 deletions

View File

@ -13,7 +13,7 @@
<groupId>group.flyfish</groupId>
<artifactId>rest-proxy</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@ -22,7 +22,7 @@
<java.version>1.8</java.version>
<commons-collection.version>4.4</commons-collection.version>
<commons.lang.version>2.6</commons.lang.version>
<sdk.version>1.1.6</sdk.version>
<sdk.version>1.1.7</sdk.version>
</properties>
<packaging>pom</packaging>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>group.flyfish</groupId>
<artifactId>rest-proxy</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>group.flyfish</groupId>
<artifactId>rest-proxy</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -18,6 +18,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.*;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.lang.NonNull;
@ -62,7 +63,8 @@ public class RestApiRegistry implements BeanDefinitionRegistryPostProcessor, Bea
// 找基本包找不到立马报错
beanFactory.getBeansWithAnnotation(EnableRestApiProxy.class)
.forEach((key, value) -> {
EnableRestApiProxy proxy = value.getClass().getAnnotation(EnableRestApiProxy.class);
EnableRestApiProxy proxy = AnnotationUtils.findAnnotation(value.getClass(), EnableRestApiProxy.class);
if (null == proxy) return;
for (String basePackage : proxy.basePackages()) {
if (DataUtils.isNotBlank(basePackage)) {
packageNames.add(basePackage);