RunFailException.java
648 Bytes
package com.huaheng.common.exception;
import com.huaheng.common.exception.service.ServiceException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
/**
* @ClassName SendException
* @Description TODO
* @Author Administrator
* @Date 2021/8/2411:21
*/
@Service
public class RunFailException {
public void sendException(String message){
try{
throw new ServiceException(message);
}catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
}
}