这篇文章主要介绍“Spring Transactional事务和日志的用法”,在日常操作中,相信很多人在Spring Transactional事务和日志的用法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Spring Transactional事务和日志的用法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
1、主要代码
// 切换数据源
@DataSourceRouting
// 开始事务
@Transactional(rollbackFor = Exception.class)
public boolean test1(Long userId, List<String> labelList) {
biz1(userId, labelList);
biz2(userId, labelList);
return true;
}
public boolean biz1(Long userId, List<String> labelList) {
log.info("》》》》》》》》插入 FamilyPlanLabelDetail 》》》 开始");
FamilyPlanLabelDetail familyPlanLabelDetail = new FamilyPlanLabelDetail();
familyPlanLabelDetail.setUserId(userId);
familyPlanLabelDetail.setCreateTime(new Date());
int numLabelDetail = familyPlanDao.saveFamilyPlanLabelDetail(familyPlanLabelDetail);
log.info("》》》》》》》》插入 FamilyPlanLabelDetail 》》》 结束");
return true;
}
public boolean biz2(Long userId, List<String> labelList) throws Exception {
log.info("》》》》》》》》插入 FamilyPlanLabel 》》》 开始");
List<FamilyPlanLabel> list = new ArrayList();
for (String labelName : labelList) {
FamilyPlanLabel familyPlanLabel = new FamilyPlanLabel();
familyPlanLabel.setUserId(userId);
familyPlanLabel.setLabelName(labelName);
familyPlanLabel.setType(FamilyPlanLabelTypeEnum.SYS_ADD.getCode());
familyPlanLabel.setStatus(FamilyPlanLabelStatusEnum.USE.getCode());
familyPlanLabel.setCreateTime(new Date());
familyPlanLabel.setUpdateTime(new Date());
list.add(familyPlanLabel);
}
int labelNum = familyPlanDao.saveFamilyPlanLabelByBatch(list);
if (true) {
// 模拟出异常
throw new Exception("手动抛异常");
}
log.info("》》》》》》》》插入 FamilyPlanLabel 》》》 结束");
return true;
}
2 开事务
2.1 开事务,正常的日志
// 方法上有注解 @DataSourceRouting @Transactional
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法执行开始执行,数据源切换到:master
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》查询 FamilyPlanLabelDetail 》》》 开始
// 因为在事务中,切换数据源并没有用
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId(...)方法执行开始执行,没有配置数据源,切换到默认:master
// 开启事务
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@eeede52] will be managed by Spring
com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@eeede52]
com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId ==> Preparing: SELECT id, user_id AS userId, create_time AS createTime FROM t_detail WHERE user_id = ?
com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId ==> Parameters: 1(Long)
org.mybatis.spring.SqlSessionUtils Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》查询 FamilyPlanLabelDetail 》》》 结束
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 开始
// 因为在事务中,切换数据源并没有用
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b] from current transaction
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@eeede52]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Preparing: INSERT INTO t_detail ( user_id, create_time ) VALUES ( ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Parameters: 1(Long), 2019-09-16 12:02:00.075(Timestamp)
org.mybatis.spring.SqlSessionUtils Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 结束
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 开始
// 因为在事务中,切换数据源并没有用
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b] from current transaction
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@eeede52]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Preparing: INSERT INTO t_label ( user_id, label_name, type, status, create_time, update_time ) VALUES ( ?, ?, ?, ?, ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Parameters: 1(Long), test1342966(String), 1(Integer), 1(Integer), 2019-09-16 12:02:00.917(Timestamp), 2019-09-16 12:02:00.917(Timestamp)
org.mybatis.spring.SqlSessionUtils Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 结束
// 提交事务
org.mybatis.spring.SqlSessionUtils Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
org.mybatis.spring.SqlSessionUtils Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@cdf939b]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法执行完成,清理数据源
注意:
(1)org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@3d2fb2bf] will be managed by Spring
(2)org.mybatis.spring.SqlSessionUtils Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@251c52c5]
2.2 开事务,出现异常回滚的日志
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法执行开始执行,数据源切换到:master
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@3d2fb2bf] will be managed by Spring
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@3d2fb2bf]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Preparing: INSERT INTO t_detail ( user_id, create_time ) VALUES ( ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Parameters: 1(Long), 2019-09-16 10:26:50.722(Timestamp)
org.mybatis.spring.SqlSessionUtils Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 结束
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835] from current transaction
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@3d2fb2bf]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Preparing: INSERT INTO t_label ( user_id, label_name, type, status, create_time, update_time ) VALUES ( ?, ?, ?, ?, ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Parameters: 1(Long), test1591984(String), 1(Integer), 1(Integer), 2019-09-16 10:27:12.847(Timestamp), 2019-09-16 10:27:12.847(Timestamp)
org.mybatis.spring.SqlSessionUtils Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行完成,清理数据源
org.mybatis.spring.SqlSessionUtils Transaction synchronization rolling back SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
org.mybatis.spring.SqlSessionUtils Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法执行完成,清理数据源
com.moon.home.controller.AtestController 出现了异常
java.lang.RuntimeException: 家庭计划,初始化账户系统默认账户类型.出现异常
at com.moon.client.transaction.manager.FamilyPlanTransactionManager.biz2(FamilyPlanTransactionManager.java:367) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(FamilyPlanTransactionManager.java:382) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager$$FastClassBySpringCGLIB$$728e76cf.invoke(<generated>) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
注意:
(1)org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@3d2fb2bf] will be managed by Spring
(2)org.mybatis.spring.SqlSessionUtils Transaction synchronization rolling back SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@67334835]
2.3 开启事务总结
(1)方法上加了@Transactional ,在进入方法的业务代码前(本例就是进入 test1() 的业务代码前)已经决定了使用哪个数据源,在业务方法 biz1()或biz2()内切换数据源是无效的。
(2) 加了@Transactional注解,如果在进入test1()方法前指定了数据源,test1() 没有在切面中切换数据源,则以进入test1()方法前用的数据源为准;如果没有指定数据源,以系统配置的默认数据源。
(3)并不是加了@Transactional 注解,在进入test1() 方法后就开启事务,是有SQL执行时才会开启事务。
3 不开事务
3.1 不开事务,执行成功日志
// 进入 biz1(...)方法
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@57494412] was not registered for synchronization because synchronization is not active
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0] will not be managed by Spring
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Preparing: INSERT INTO t_detail ( user_id, create_time ) VALUES ( ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Parameters: 1(Long), 2019-09-17 11:06:00.781(Timestamp)
org.mybatis.spring.SqlSessionUtils Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@57494412]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 结束
// 进入 biz2(...)方法
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5471460] was not registered for synchronization because synchronization is not active
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0] will not be managed by Spring
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Preparing: INSERT INTO t_label ( user_id, label_name, type, status, create_time, update_time ) VALUES ( ?, ?, ?, ?, ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Parameters: 1(Long), test1(String), 1(Integer), 1(Integer), 2019-09-17 11:06:01.056(Timestamp), 2019-09-17 11:06:01.056(Timestamp)
org.mybatis.spring.SqlSessionUtils Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5471460]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 结束
3.2 不开事务,抛出异常日志
// 进入 biz1(...)方法
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@65ad141b] was not registered for synchronization because synchronization is not active
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0] will not be managed by Spring
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Preparing: INSERT INTO t_detail ( user_id, create_time ) VALUES ( ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail ==> Parameters: 1(Long), 2019-09-17 10:55:05.748(Timestamp)
org.mybatis.spring.SqlSessionUtils Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@65ad141b]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法执行完成,清理数据源
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 结束
// 进入 biz2(...)方法
com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 开始
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行开始执行,没有配置数据源,切换到默认:master
org.mybatis.spring.SqlSessionUtils Creating a new SqlSession
org.mybatis.spring.SqlSessionUtils SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4d1121df] was not registered for synchronization because synchronization is not active
org.mybatis.spring.transaction.SpringManagedTransaction JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0] will not be managed by Spring
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ooo Using Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@320e24b0]
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Preparing: INSERT INTO t_label ( user_id, label_name, type, status, create_time, update_time ) VALUES ( ?, ?, ?, ?, ?, ? )
com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch ==> Parameters: 1(Long), test1(String), 1(Integer), 1(Integer), 2019-09-17 10:55:06.6(Timestamp), 2019-09-17 10:55:06.6(Timestamp)
org.mybatis.spring.SqlSessionUtils Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4d1121df]
com.moon.core.dbUtils.DataSourceAspect 【数据源处理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法执行完成,清理数据源
// biz2里的saveFamilyPlanLabelByBatch()方法抛出异常
com.moon.appserver.controller.privates.TestTranController
java.lang.Exception: 手动抛异常
at com.moon.client.transaction.manager.FamilyPlanTransactionManager.biz2(FamilyPlanTransactionManager.java:366) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(FamilyPlanTransactionManager.java:380) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager.test2(FamilyPlanTransactionManager.java:385) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager$$FastClassBySpringCGLIB$$728e76cf.invoke(<generated>) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at com.moon.client.transaction.manager.FamilyPlanTransactionManager$$EnhancerBySpringCGLIB$$d931e707.test2(<generated>) ~[CKclient-1.0.0-SNAPSHOT.jar:na]
at com.moon.appserver.controller.privates.TestTranController.test(TestTranController.java:29) ~[classes/:na]
到此,关于“Spring Transactional事务和日志的用法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/u/3777515/blog/3106405