如下代码是不会回滚的:
public class UserSerivceImpl implements UserService {
public add(){
this.addUser();
}
@Transactional(rollbackFor = Exception.class)
private void addUser(){
}
}
改成这样可以回滚:
public class UserSerivceImpl implements UserService {
@Transactional(rollbackFor = Exception.class)
public add(){
this.addUser();
}
private void addUser(){
}
}