【发布时间】:2017-11-09 14:02:50
【问题描述】:
我应该大摇大摆地记录我们的控制器。
我加了
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.0</version>
</dependency>
进入 pom.xml。
在 spring-web.xml 中:
<bean id="swagger2Config" class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration" />
在控制器中我添加了注释。当我打电话给host:port/v2/api-doc 时,我看到了 json。
如何在 swagger-ui.html 中看到相同的内容?
【问题讨论】:
-
Hhit
localhost:8080/swagger-ui.html假设您的应用程序在 8080 端口上运行 -
你应该将你的 springfox 依赖升级到 2.8.0。另请查看this sample application 以获取示例应用程序。
标签: spring spring-mvc documentation swagger swagger-ui