1. 问题描述
随着软件过程的不断发展,前后端分离开发模式被越来越的开发团队使用,今天介绍下前后分离中必用的接口设计与调试工具-swagger2,前端人员根据swagger的描述,进行参数的传递;前后端联调的时候,出现问题,首先使用swagger进行测试调用,定位问题,还可以通过界面导出swagger2接口文档,修改完善后作为其他系统调用说明文档。
2. 问题方案
采用springboo+swagger2方式运行swagger。
2.1 pom文件配置
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
2.2 springboot启动类配置标签
@Enable