diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java index bba1c059a..6b41ee739 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java @@ -11,8 +11,8 @@ import com.ruoyi.common.enums.DataSourceType; /** * 自定义多数据源切换注解 * - * 优先级: 先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 - * + * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 + * * @author ruoyi */ @Target({ ElementType.METHOD, ElementType.TYPE }) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java index cb5164603..f72b8051b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java @@ -1,6 +1,5 @@ package com.ruoyi.framework.aspectj; -import java.lang.reflect.Method; import java.util.Objects; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -18,7 +17,7 @@ import com.ruoyi.common.utils.StringUtils; /** * 多数据源处理 - * + * * @author ruoyi */ @Aspect @@ -62,8 +61,6 @@ public class DataSourceAspect public DataSource getDataSource(ProceedingJoinPoint point) { MethodSignature signature = (MethodSignature) point.getSignature(); - // point.getTarget().getClass(); 这个获取的是动态代理的class,上面获取不到自定义注解 - // 先获取方法上的,获取不到啊再从class上找 DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); if (Objects.nonNull(dataSource)) {