【发布时间】:2017-08-20 16:12:15
【问题描述】:
我在 Spring Boot 项目中为 Spring Data Rest 生成的端点设置了 Swagger 集成设置。以下是我在项目中的相关依赖:
compile "io.springfox:springfox-swagger2:2.6.1"
compile "io.springfox:springfox-swagger-ui:2.6.1"
compile "io.springfox:springfox-data-rest:2.6.1"
compile "io.springfox:springfox-bean-validators:2.6.1"
Swagger 中为这些端点设置的标题是多种多样的。例如,我有
curl -X GET --header 'Accept: application/x-spring-data-compact+json' 'http://localhost:8080/accounts'
标头中的接受或内容类型应为 application/json。如何设置正确的标题?
【问题讨论】:
-
没有下拉框可以选择
application/json或application/x-spring-data-compact+json吗? -
是的,有一个下拉列表。但是 application/json 或 application/+json 不存在。
标签: swagger spring-data-rest springfox