更新时间:2023-01-03 18:42:04
我解决了这个问题(自定义异常处理程序必须扩展 ResponseEntityExceptionHandler
).我的解决方案如下:
I solved the issue
(the custom exception handler must extend ResponseEntityExceptionHandler
).
My solution follows:
@ControllerAdvice
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleHttpMessageNotReadable(
HttpMessageNotReadableException ex, HttpHeaders headers,
HttpStatus status, WebRequest request) {
// paste custom hadling here
}
}