fix: 修改swagger配置增加了新的组

This commit is contained in:
weihongyang 2022-06-23 14:21:44 +08:00
parent 036cc1ac25
commit d3322639de

View File

@ -41,7 +41,7 @@ public class SwaggerConfig {
@Bean
public Docket restApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("标准接口")
.groupName("全部接口")
.apiInfo(apiInfo("Spring Boot中使用Swagger2构建RESTful APIs", "1.0"))
.useDefaultResponseMessages(true)
.forCodeGeneration(false)
@ -54,6 +54,22 @@ public class SwaggerConfig {
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}
@Bean
public Docket adminApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("admin模块接口")
.apiInfo(apiInfo("Spring Boot中使用Swagger2构建RESTful APIs", "1.0"))
.useDefaultResponseMessages(true)
.forCodeGeneration(false)
.select()
.apis(RequestHandlerSelectors.basePackage("com.cnbm.admin"))
.paths(PathSelectors.any())
.build()
.securityContexts(Arrays.asList(securityContext()))
// ApiKey的name需与SecurityReference的reference保持一致
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}
/**
* 创建该API的基本信息这些基本信息会展现在文档页面中
* 访问地址http://ip:port/swagger-ui.html