Springboot-Swagger2看完这篇就够了
引入Swagger2 maven
<!-- 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>
SpringBoot 启用类中添加@EnableSwagger2主机
@EnableSwagger2 是springfox提供的一个注解 代表Swagger2相关技术开启。会扫描当前类所在包,及子包中所有的类型中的注解。做swagger文档的定值
运行springboot 打开swagger-ui
springboot运行成功后 打开http://localhost:8080/swagger-ui.html 看看能否运行成功