@Transactional(rollbackFor = Exception.class)
@Override
public DubboResult<Boolean> productAddOrModify(MallProductAddModifyReq req) {
log.info("权益商城商品添加,请求参数={}", req);
try {
boolean resutl1 = productService.handleIntegralProduct(req);
boolean result2 = productStaticService.handleProductIntegralStatic(req);
boolean result3 = skuService.handleIntegralSku(req);
boolean result = resutl1 && result2 && result3;
log.info("saleId={}控制台新增或修改商品={},result={}", req.getSourceCode(), result);
return DubboResult.ofSuccess(result);
} catch (BizException e) {
return DubboResult.ofFailure("-1",e.getMessage());
}
}
上述异常引起的原因是各个业务方法方法头部都有
@Transactional(rollbackFor = Exception.class)标识,他们在抛出异常时,被spring标记为 rollback-only,这个时候 外层事务 最终捕获异常后 正常结束了所以就抛出了此异常