swagger的使用说明
目录
- swagger的使用说明
- 1 springfox2整合swagger
- 2 springfox3整合swagger
swagger的使用说明
对于swagger的使用,实际上,我们不是单独使用,都是以springfox整合swagger的方式来使用的。以下是两个springfox版本的使用说明。
1 springfox2整合swagger
-
访问URL: http://host:port/context-path/swagger-ui.html
eg. http://localhost:8888/swagger-ui.html -
文档接口: http://localhost:8888/v2/api-docs
-
maven依赖
com.spring4all
swagger-spring-boot-starter
1.9.0.RELEASE
以上依赖,实际上内部包含了以下2个swagger依赖:
io.springfox
springfox-swagger-ui
2.9.2
io.springfox
springfox-swagger2
2.9.2
2 springfox3整合swagger
-
访问URL:
旧URL也能用:http://host:port/context-path/swagger-ui.html
还添加了新的URL:http://host:port/context-path/swagger-ui/
另一个新的URL:http://host:port/context-path/swagger-ui/index.html
eg1. http://localhost:8888/swagger-ui/
eg2. http://localhost:8888/swagger-ui/index.html -
文档接口:
旧的也能用:http://localhost:8888/v2/api-docs
还添加了新的:http://localhost:8888/v3/api-docs -
maven依赖
io.springfox
springfox-boot-starter
3.0.0
io.swagger
swagger-models
1.6.2
以上依赖,实际上内部包含了以下2个swagger依赖:
io.springfox
springfox-swagger2
3.0.0
compile
io.springfox
springfox-swagger-ui
3.0.0
compile