SwaggerConfig配置类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()).build();
}


private ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title("熹烨网络小说分析系统管理API")
.description("熹烨网络小说分析系统的API文档.")
.version("1.0")
.build();
}
}

然后访问localhost:9090/swagger-ui.html