如何改变异常的swagger响应

时间:2015-12-10 11:11:49

标签: java spring spring-boot swagger-ui exceptionmapper

我正在使用带有swagger的spring boot来进行REST API服务。当异常发生时,swagger以下列格式返回响应

    {
  "timestamp": 1449742584285,
  "status": 500,
  "error": "Internal Server Error",
  "exception": "com.foo.exception.NotFoundException",
  "message": "User with id 1 not found",
  "path": "/user/1"
}

我想要只显示消息,而不是返回详细的响应。此外,服务器也始终使用RuntimeException

如何实现招摇,只撤回信息。

0 个答案:

没有答案