【Swagger2】【2】SpringBoot整合Swagger2
前言: 做前后端分离的项目,非常重要的一点就是写好接口文档,用Swagger可以自动同步代码里的注解内容,同时可以直接在页面请求接口。 使用过程中,也发现了一些缺点,比如不能记录上次请求接口的数据,必须先发布代码才能看到Swagger页面。所以我们已经改用YApi了,YApi的接口可以手写,也可以从Swagger导入,这个属于工具,不属于代码范畴了。不过我们依然在代码里保留了Swagger,因为注解看着挺清晰的 项目为:SpringBoot + Maven 正文: 访问地址: http://localhost:8080/swagger-ui.html 配置: pom.xml <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.1</version> </dependency> Swagger配置类 package com.bf; import org