@RestControllerAdvice
public class ExceptionHandler {
@org.springframework.web.bind.annotation.ExceptionHandler(value=MissingServletRequestParameterException.class)
public ApiRest MissingServletRequestParameterException(MissingServletRequestParameterException ex) {
return new ApiRest().failureWithMsg("参数缺失!");
}
}
ApiRest类是自己定义的统一返回类