【发布时间】:2017-03-15 13:14:28
【问题描述】:
我在不同的 OSGI 包中都有用 @Transactional 注释的方法。所有的bundles都使用了spring提供的自己的事务管理器。现在,如果我使用 bundle1 和 bundle2 的 OSGI 引用在 bundle3 中调用 methodA() 和 methodB(),它会包含在单个事务中吗?那么,如果 methodB() 失败,是否应该回滚 methodA() 呢?
捆绑1
class ServiceA {
@Transactional
public void methodA() {
..........
}
}
捆绑包2
class ServiceB {
@Transactional
public void methodB() {
..........
}
}
捆绑3
class ServiceC {
@Autowired
Bundle1 b1;
@Autowired
Bundle2 b2;
@Transactional
public void methodC() {
b1.methodA();
b2.methodB();
}
}
【问题讨论】:
标签: java spring spring-mvc transactions osgi