下面是我的Spring配置
通过上面的配置可以看出我是在所有的service中加入的事物,也就是说我的service出错了会回滚所有的提交。
那么如果遇到Aservice调用Bservice的方法,然后Bservice调用了Cservice层的方法,
A->B->C
这种情况属于事物层嵌套调用,那么问题来了我在Cservice中如果出现异常,现在是只会回滚Cservice的事物,还是会把A和B的事物都回滚。
请大牛来帮忙解释下这个问题。我也是突然想到有这种情况实际没有这么做呢~
怪我咯2017-04-18 10:55:17
I haven’t tried this. However, it is generally not recommended that service calls service. Some common ones can be placed in dao
怪我咯2017-04-18 10:55:17
propagation="REQUIRED" means that if a transaction currently exists, put it into the current transaction scope, otherwise create a new transaction. So they will all belong to the same transaction.
PHPz2017-04-18 10:55:17
This can be defined using the propagation method of the configuration transaction. Do you want to join the current transaction or create a new transaction yourself?