Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
1cb17434
Commit
1cb17434
authored
May 19, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据源类型优先级,先根据方法,再根据类
parent
f24da2fc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
4 deletions
+1
-4
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
+1
-1
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
+0
-3
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
View file @
1cb17434
...
...
@@ -11,7 +11,7 @@ import com.ruoyi.common.enums.DataSourceType;
/**
* 自定义多数据源切换注解
*
* 优先级:
先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
*
* @author ruoyi
*/
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java
View file @
1cb17434
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
;
...
...
@@ -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
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment