需求是在已有的Spring+SpringMVC+Mybatis的项目中整合Springfox(Swagger2)。
在网上查看了非常多的博客,均没有解决问题。经过一天多的摸索,总算是成功的完成了整合。现在将具体的步骤记录下来,希望能给有需求的朋友提供参考。
注意:此篇文章仅讲解整合完成SSM三大框架以后整合Springfox(Swagger2)
1、在maven的pom文件中引入springfox的依赖
<!--springfox的核心jar包-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<!--springfox-ui的jar包(里面包含了swagger的界面静态文件)-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!--springfox依赖的jar包;如果你的项目中已经集成了无需重复-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId