一、如果用到了try-catch,需要在catch中再次抛出RuntimeException("")异常
@Transactional(rollbackFor=Exception.class)
public CommonResult anecdoterecordsServiceSave(Anecdoterecords anecdoterecords, HttpServletRequest request, String picMvIds) throws Exception {try { //dao层的操作... //测试事务回滚int aaaaaaa = 10;int bbbbbbb = 0;if(aaaaaaa/bbbbbbb == 100){System.err.println("哈哈哈哈哈哈哈哈哈");}return something; } catch (Exception e) {throw new RuntimeException(e.getMessage()); //抛出RuntimeException异常}
}