Spring在service层事物和@AfterThrowing添加日志冲突
来源:互联网 发布:exescope是什么软件 编辑:程序博客网 时间:2024/06/04 01:33
因为@AfterThrowing方法在service事物rollback之前执行(具体看源码),添加日志成功以后还是会被rollback
解决:
@Aspect类implementsOrdered,事物添加Order属性。
@Aspect类order<aop:advisor order
Order小会先执行
<aop:advisor pointcut="execution(* com.web.*.service..*.*(..))"advice-ref="txAdvice" order="3"/>order> aop:advisor order: transaction -> doBefore -> Exception -> @AfterThrowing -> rollbackorder< aop:advisor order: doBefore -> transaction -> Exception -> rollback -> @AfterThrowing
order> aop:advisor 时日志生成后会被回滚,所以@Aspect类中order需比aop:advisor中配置的小
0 0
- Spring在service层事物和@AfterThrowing添加日志冲突
- spring springmvc 将事物管理(@Transactional)分别加在 controller和service层
- spring springmvc 将事物管理(@Transactional)分别加在 controller和service层
- spring struts 将事物管理(@Transactional)加在service层
- Spring配置事务在DAO层和Service层
- Spring配置事务在Dao层和Service层
- Spring配置事务在DAO层和Service层
- spring AOP 事务 与 Afterthrowing 冲突的解决办法
- spring AOP 事务 与 Afterthrowing 冲突的解决办法
- Spring配置事务在DAO层和SERVICE层(事务在service中的实现)
- spring实现service层日志管理
- Spring事务配置在DAO和Service层
- spring在service层获取session和request
- spring在service层获取session和request
- 事物层spring简介
- spring 事物日志
- spring在多个service中的方法不在同一个事物
- 笔记:在使用spring aop添加日志时对在controller层无效
- ssh
- 文章标题
- Android并行开发
- 安卓扫一扫车牌OCR技术识别车牌
- python爬取图片
- Spring在service层事物和@AfterThrowing添加日志冲突
- 象牙塔之坑
- mysql处理字符串的两个绝招:substring_index,concat
- Ubuntu 16.04安装Eclipse
- WOJ 26 Lost in WHU(矩阵快速幂+邻接矩阵乘法)
- 面试题
- Ecshop模板开发(十五):商品详情页购买过该商品的人还购买了
- java实现二维数组排序并定位坐标(借助list)
- QT5简易音乐播放器的设计