@ ExceptionHandler ( HttpMessageNotReadableException . class ) public ResponseEntity < ExceptionInfo > handleHttpMessageNotReadableException ( final HttpServletRequest request , final Exception ex ) { logRequest ( request , ex ) ; final ExceptionInfo response = createExceptionInfo ( new MessageNotReadableException ( ) ) ; return new ResponseEntity <> ( response , HttpStatus . BAD_REQUEST ) ; }
Method for handling exception of type HttpMessageNotReadableException which is thrown in case the request body is not well formed and cannot be deserialized . Called by the Spring - Framework for exception handling .