打开 pom.xml 并添加这些依赖项
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter --> |
- 使用 Swagger 3,您无需添加 Docket 配置或使用 @EnableSwagger2 注释。一切都由 Springfox-boot-starter 处理,我们刚刚在上面的 pom.xml 中添加了它。
就是这样。完毕!运行 Spring Boot 应用程序主类并在浏览器中点击以下 URL。
http://localhost:8080/swagger-ui/
请注意上面 URL 中的更改。现在不需要是swagger-ui.html,还要注意localhost URL 末尾的结尾正斜杠(“/”)。
Github 上提供的代码 – https://github.com/webfuse2017/wf-spring-poc/