|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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();
}
}
}
|