1、maven依赖

  maven仓库(https://mvnrepository.com/)搜索springfox

使用Swagger自动生成文档

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.9.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.9.2</version>
</dependency>

 

2、springboot集成swagger2

  1)创建一个springboot项目,pom.xml引入上面贴出的两个依赖jar;

  2)在springboot启动类上加注解@EnableSwagger2;

  3)启动项目,在浏览器输入localhost:8081/swagger-ui.html。

 

3、swagger2常用的注解

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-02
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-05
  • 2022-12-23
  • 2021-11-10
  • 2021-07-04
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案