这里需要手动回退:
**
* TODO 捕获异常后回滚事务
*
* @author songtianxiong
* @version 1.0
* @date 2022/6/9 10:25
*/
public class SpringRollBackUtil {
/**
* 事务回滚机制
*/
public static void rollBack() {
try {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
SpringRollBackUtil.rollBack();
rspContent.setRspCode(1 + "");
rspContent.setRspDesc("出现异常");
}