【发布时间】:2015-04-05 16:34:37
【问题描述】:
到目前为止,我对 spring-boot 项目感到非常满意,但我想更深入地了解一切是如何粘合在一起的。使用 spring-boot-starter-web、spring-boot-starter-data-jpa 和 hateoas,我能够组装一个很好的工作 REST 后端。但我想知道,它是如何完成的,例如一个 DataIntegrityViolation 很好地转换成这样的 JSON 输出。我实际上喜欢提供的信息,但我想知道如何重用转换为 JSON 的 DataObject。我只是不明白,它来自哪里以及它在哪里配置。希望你们能帮助我或指出文档的相关部分甚至源代码。
{
"readyState": 4,
"responseText": "{\"timestamp\":1423155860435,\"status\":500,\"error\":\"Internal Server Error\",\"exception\":\"org.springframework.dao.InvalidDataAccessResourceUsageException\",\"message\":\"could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet\",\"path\":\"/api/catalog/colorfamilies\"}",
"responseJSON": {
"timestamp": 1423155860435,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.dao.InvalidDataAccessResourceUsageException",
"message": "could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet",
"path": "/api/catalog/colorfamilies"
},
"status": 500,
"statusText": "Internal Server Error"
}
感谢您的帮助, 马吕斯
【问题讨论】:
标签: spring-mvc configuration spring-boot default