Swagger3.0
生活随笔
收集整理的這篇文章主要介紹了
Swagger3.0
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
號稱世界上最流行的Api框架,可以直接運行,能夠即時提供接口信息,并且可以在線測試Api接口。
1.舊版本中導入依賴和訪問方式
//導入依賴<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>2.9.2</version></dependency> //配置類 package com.yk.config;import org.springframework.context.annotation.Configuration; import springfox.documentation.swagger2.annotations.EnableSwagger2;//這倆注解 @Configuration @EnableSwagger2 public class SwaggerConfig { }訪問地址http://127.0.0.1:8080/swagger-ui.html
2.新版本
//導入依賴<dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version></dependency> package com.yk.config;import org.springframework.context.annotation.Configuration; import springfox.documentation.oas.annotations.EnableOpenApi;@Configuration @EnableOpenApi public class SwaggerConfig {}訪問地址http://127.0.0.1:8080/swagger-ui/index.html
總結
以上是生活随笔為你收集整理的Swagger3.0的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自定义登陆页面
- 下一篇: swagger配置分组