mark
This commit is contained in:
@@ -54,6 +54,22 @@ public class SwaggerConfig {
|
||||
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket basicApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("ym-basic")
|
||||
.apiInfo(apiInfos("basic", "基础资料模块"))
|
||||
.useDefaultResponseMessages(true)
|
||||
.forCodeGeneration(false)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.cnbm.basic"))
|
||||
.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
|
||||
@@ -68,6 +84,14 @@ public class SwaggerConfig {
|
||||
.version(version)
|
||||
.build();
|
||||
}
|
||||
private ApiInfo apiInfos(String title, String desc) {
|
||||
return new ApiInfoBuilder()
|
||||
.title(title)
|
||||
.description(desc)
|
||||
.termsOfServiceUrl("https://www.baidu.com/")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
private SecurityContext securityContext() {
|
||||
return SecurityContext.builder()
|
||||
|
||||
Reference in New Issue
Block a user