版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/w592376568/article/details/81706151
@Transactional(rollbackFor = { Exception.class })
public String methods() {
String str = "-----------";
try {
doSomethings......
} catch (Exception e) {
logger.error("e.getMessage()", e);
//手动开启事务回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return str;
}