使用Spring并遇到下一种情况:
public class Service1{
@Autowired
Service2 service2;
@Transactional(noRollBackFor = MyException.class)
public void service1(){
service2.service2();
}
}
public class Service2{
@Transactional
public void service2(){
throw new MyException();
}
}
为什么在调用service2.service2()时将事务标记为“ rollbackonly”?我不明白,因为这两种事务方法共享同一事务,并且该事务被标记为“ noRollBackFor = MyException.class”
谢谢