【发布时间】:2017-12-04 15:50:57
【问题描述】:
我有一个使用 Spring Boot 开发的 REST Web 服务。我能够处理由于我的代码而发生的所有异常,但假设客户端发布的 json 对象与我想要反序列化的对象不兼容有了,我得到了
"timestamp": 1498834369591,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.http.converter.HttpMessageNotReadableException",
"message": "JSON parse error: Can not deserialize value
我想知道是否有一种方法可以针对此异常向客户端提供自定义异常消息。我不知道如何处理这个错误。
【问题讨论】:
标签: json spring rest spring-mvc spring-boot