Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
aba3fe5a
Commit
aba3fe5a
authored
Apr 23, 2020
by
Water Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
4bd99ea5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicDataSourceAspect.java
+3
-3
No files found.
yd-api/src/main/java/com/yd/util/intercept/commons/DynamicDataSourceAspect.java
View file @
aba3fe5a
...
@@ -33,10 +33,10 @@ public class DynamicDataSourceAspect {
...
@@ -33,10 +33,10 @@ public class DynamicDataSourceAspect {
public
void
doBefore
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
public
void
doBefore
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
DataSourceKey
dataSourceKey
=
targetDataSource
.
dataSourceKey
();
DataSourceKey
dataSourceKey
=
targetDataSource
.
dataSourceKey
();
if
(
dataSourceKey
==
DataSourceKey
.
DB_MASTER
)
{
if
(
dataSourceKey
==
DataSourceKey
.
DB_MASTER
)
{
LOG
.
info
(
String
.
format
(
"默认数据源 %s"
,
DataSourceKey
.
DB_MASTER
));
//
LOG.info(String.format("默认数据源 %s", DataSourceKey.DB_MASTER));
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_MASTER
);
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_MASTER
);
}
else
if
(
dataSourceKey
==
DataSourceKey
.
DB_EGOLDEN
)
{
}
else
if
(
dataSourceKey
==
DataSourceKey
.
DB_EGOLDEN
)
{
LOG
.
info
(
String
.
format
(
"设置数据源 %s"
,
DataSourceKey
.
DB_EGOLDEN
));
//
LOG.info(String.format("设置数据源 %s", DataSourceKey.DB_EGOLDEN));
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_EGOLDEN
);
DynamicDataSourceContextHolder
.
set
(
DataSourceKey
.
DB_EGOLDEN
);
}
}
}
}
...
@@ -49,7 +49,7 @@ public class DynamicDataSourceAspect {
...
@@ -49,7 +49,7 @@ public class DynamicDataSourceAspect {
*/
*/
@After
(
"@annotation(targetDataSource)"
)
@After
(
"@annotation(targetDataSource)"
)
public
void
doAfter
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
public
void
doAfter
(
JoinPoint
joinPoint
,
TargetDataSource
targetDataSource
)
{
LOG
.
info
(
String
.
format
(
"当前数据源 %s 执行清理方法"
,
targetDataSource
.
dataSourceKey
()));
//
LOG.info(String.format("当前数据源 %s 执行清理方法", targetDataSource.dataSourceKey()));
DynamicDataSourceContextHolder
.
clear
();
DynamicDataSourceContextHolder
.
clear
();
}
}
...
...
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