2

ASPECT中如何获得SPRING所管理的事务.?

 8 months ago
source link: https://www.jdon.com/38930.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ASPECT中如何获得SPRING所管理的事务.?

项目使用spring来管理的业务逻辑的事务, 也意识到需要添加缓存.

但是现在面临下面两个问题:

1. 缓存准备用在dao类上面做aop, 然而事务做在service上面, 所以无法确定同一个事务中的操作调用了哪些dao类,
2. 也无法在事务提交或者回滚的时候得到通知来操作缓存

第一个问题想了好久都没有解决, 曾经貌似在那里看到一个TransactionUtils的类吧. 但是现在一直都没有找到..
第二个问题, 感觉可以在PlatformTransaction接口上面做文章, 在提交事务的方法上面做一个环绕通知, 但是发现所有关于事务操作的方法不是final就是protected的... 郁闷.. 难道得修改spring源码重新编译么.?

现在头都是大的, 上面的描述可能有点混乱.. 还请


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK