您好,登錄后才能下訂單哦!
這篇文章主要介紹“Spring Transactional事務和日志的用法”,在日常操作中,相信很多人在Spring Transactional事務和日志的用法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Spring Transactional事務和日志的用法”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
1、主要代碼
// 切換數(shù)據(jù)源 @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 【數(shù)據(jù)源處理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法執(zhí)行開始執(zhí)行,數(shù)據(jù)源切換到:master com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》查詢 FamilyPlanLabelDetail 》》》 開始 // 因為在事務中,切換數(shù)據(jù)源并沒有用 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.queryFamilyPlanLabelDetailByUserId(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》查詢 FamilyPlanLabelDetail 》》》 結束 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 開始 // 因為在事務中,切換數(shù)據(jù)源并沒有用 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 結束 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 開始 // 因為在事務中,切換數(shù)據(jù)源并沒有用 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行完成,清理數(shù)據(jù)源 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 【數(shù)據(jù)源處理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法執(zhí)行完成,清理數(shù)據(jù)源
注意:
(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 開事務,出現(xiàn)異常回滾的日志
com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法執(zhí)行開始執(zhí)行,數(shù)據(jù)源切換到:master com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 結束 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行完成,清理數(shù)據(jù)源 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 【數(shù)據(jù)源處理】com.moon.client.transaction.manager.FamilyPlanTransactionManager.test1(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.home.controller.AtestController 出現(xiàn)了異常 java.lang.RuntimeException: 家庭計劃,初始化賬戶系統(tǒng)默認賬戶類型.出現(xiàn)異常 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 ,在進入方法的業(yè)務代碼前(本例就是進入 test1() 的業(yè)務代碼前)已經(jīng)決定了使用哪個數(shù)據(jù)源,在業(yè)務方法 biz1()或biz2()內(nèi)切換數(shù)據(jù)源是無效的。
(2) 加了@Transactional注解,如果在進入test1()方法前指定了數(shù)據(jù)源,test1() 沒有在切面中切換數(shù)據(jù)源,則以進入test1()方法前用的數(shù)據(jù)源為準;如果沒有指定數(shù)據(jù)源,以系統(tǒng)配置的默認數(shù)據(jù)源。
(3)并不是加了@Transactional 注解,在進入test1() 方法后就開啟事務,是有SQL執(zhí)行時才會開啟事務。
3 不開事務
3.1 不開事務,執(zhí)行成功日志
// 進入 biz1(...)方法 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 結束 // 進入 biz2(...)方法 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 結束
3.2 不開事務,拋出異常日志
// 進入 biz1(...)方法 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelDetail(...)方法執(zhí)行完成,清理數(shù)據(jù)源 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabelDetail 》》》 結束 // 進入 biz2(...)方法 com.moon.client.transaction.manager.FamilyPlanTransactionManager 》》》》》》》》插入 FamilyPlanLabel 》》》 開始 com.moon.core.dbUtils.DataSourceAspect 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行開始執(zhí)行,沒有配置數(shù)據(jù)源,切換到默認: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 【數(shù)據(jù)源處理】com.moon.core.dao.FamilyPlanDao.saveFamilyPlanLabelByBatch(...)方法執(zhí)行完成,清理數(shù)據(jù)源 // 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事務和日志的用法”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。