Commit aba3fe5a by Water Wang

optimize

parent 4bd99ea5
...@@ -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();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment