mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
refactor: optimize FlexSpringTransaction.java
This commit is contained in:
parent
f785ca2074
commit
73fdf8b815
@ -48,14 +48,15 @@ public class FlexSpringTransaction implements Transaction {
|
||||
autoCommit = connection.getAutoCommit();
|
||||
return connection;
|
||||
}
|
||||
// 非事务
|
||||
else if (!isConnectionTransactional) {
|
||||
return connection;
|
||||
}
|
||||
// 在事务中
|
||||
else {
|
||||
// 在事务中,通过 FlexDataSource 去获取
|
||||
// FlexDataSource 内部会进行 connection 缓存以及多数据源下的 key 判断
|
||||
else if (isConnectionTransactional) {
|
||||
return dataSource.getConnection();
|
||||
}
|
||||
// 非事务,返回当前链接
|
||||
else {
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user