文章目录
spring boot swagger
上一节 Spring boot logging
源码地址
https://gitee.com/mayun_xiaodu/spring-boot-all
正文
swagger快速上手
- spring boot 集成
1. pom依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
2. swagger配置类
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2)
.enable(true)
.apiInfo(new ApiInfoBuilder()
.description("swagger-test")
.version("1.0")
.title("swagger-title")
.contact(new Contact(