import com.oohad.suppliersys.entity.JsonResult;
import org.apache.tomcat.util.http.fileupload.FileUploadBase;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
/**
* 处理全局异常
*/
@ControllerAdvice
public class MyExceptionHandler {
/**
* 方法参数校验
* @param e
* @return
*/
@ExceptionHandler({BindException.class, MethodArgumentNotValidException.class, HttpMessageN
SpringBoot 处理常见的几种异常处理, 使用全局异常统一处理
最新推荐文章于 2024-06-18 14:52:51 发布