标签:cat ica pre main group 地址 api host csdn
引入pom依赖:
<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>
到GitHub https://github.com/swagger-api/swagger-ui 下载项目,dist目录拷贝出来直接放到资源路径.
index.html 即为api页面
然后在Spring Boot 启动类加上注解 @EnableSwagger2
@SpringBootApplication @EnableSwagger2 public class NeteaseApplication { public static void main(String[] args) { SpringApplication.run(NeteaseApplication.class, args); } }
Api 地址:http://localhost:8080/api/index (地址由存放的资源路径文件夹决定)
Api-json:http://localhost:8080/v2/api-docs
Swagger2 常用注解:https://blog.csdn.net/u014231523/article/details/76522486
标签:cat ica pre main group 地址 api host csdn
原文地址:https://www.cnblogs.com/cearnach/p/8973499.html