|
17 | 17 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
18 | 18 | import com.fasterxml.jackson.databind.exc.InvalidFormatException; |
19 | 19 | import com.google.common.util.concurrent.UncheckedExecutionException; |
20 | | -import jakarta.servlet.http.HttpServletRequest; |
21 | | -import jakarta.validation.ConstraintViolation; |
22 | | -import jakarta.validation.ConstraintViolationException; |
23 | | -import jakarta.validation.ValidationException; |
24 | 20 | import lombok.AllArgsConstructor; |
25 | 21 | import lombok.extern.slf4j.Slf4j; |
26 | 22 | import org.springframework.http.converter.HttpMessageNotReadableException; |
|
37 | 33 | import org.springframework.web.bind.annotation.RestControllerAdvice; |
38 | 34 | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; |
39 | 35 | import org.springframework.web.servlet.NoHandlerFoundException; |
40 | | -import org.springframework.web.servlet.resource.NoResourceFoundException; |
41 | 36 |
|
| 37 | +import javax.servlet.http.HttpServletRequest; |
| 38 | +import javax.validation.ConstraintViolation; |
| 39 | +import javax.validation.ConstraintViolationException; |
| 40 | +import javax.validation.ValidationException; |
42 | 41 | import java.time.LocalDateTime; |
43 | 42 | import java.util.List; |
44 | 43 | import java.util.Map; |
@@ -96,9 +95,6 @@ public CommonResult<?> allExceptionHandler(HttpServletRequest request, Throwable |
96 | 95 | if (ex instanceof NoHandlerFoundException) { |
97 | 96 | return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex); |
98 | 97 | } |
99 | | - if (ex instanceof NoResourceFoundException) { |
100 | | - return noResourceFoundExceptionHandler(request, (NoResourceFoundException) ex); |
101 | | - } |
102 | 98 | if (ex instanceof HttpRequestMethodNotSupportedException) { |
103 | 99 | return httpRequestMethodNotSupportedExceptionHandler((HttpRequestMethodNotSupportedException) ex); |
104 | 100 | } |
@@ -226,15 +222,6 @@ public CommonResult<?> noHandlerFoundExceptionHandler(NoHandlerFoundException ex |
226 | 222 | return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); |
227 | 223 | } |
228 | 224 |
|
229 | | - /** |
230 | | - * 处理 SpringMVC 请求地址不存在 |
231 | | - */ |
232 | | - @ExceptionHandler(NoResourceFoundException.class) |
233 | | - private CommonResult<?> noResourceFoundExceptionHandler(HttpServletRequest req, NoResourceFoundException ex) { |
234 | | - log.warn("[noResourceFoundExceptionHandler]", ex); |
235 | | - return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getResourcePath())); |
236 | | - } |
237 | | - |
238 | 225 | /** |
239 | 226 | * 处理 SpringMVC 请求方法不正确 |
240 | 227 | * |
|
0 commit comments