码迷,mamicode.com
首页 > 其他好文 > 详细

使用Swagger自动生成文档

时间:2019-06-24 00:39:11      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:repos   注解   ima   启动   仓库   --   artifact   pid   local   

1、maven依赖

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

技术图片

<!-- 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常用的注解

 

使用Swagger自动生成文档

标签:repos   注解   ima   启动   仓库   --   artifact   pid   local   

原文地址:https://www.cnblogs.com/xy-ouyang/p/11074852.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!