diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/config/Swagger3Config.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/config/Swagger3Config.java index d62100e..abfe18c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/config/Swagger3Config.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/config/Swagger3Config.java @@ -51,12 +51,16 @@ public class Swagger3Config implements WebMvcConfigurer { */ @Bean(value = "defaultApi2") public Docket defaultApi2() { - return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() - // 此包路径下的类,才生成接口文档 - .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.wms.api")) - // 加了ApiOperation注解的类,才生成接口文档 - .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - .paths(PathSelectors.any()).build().securitySchemes(Collections.singletonList(securityScheme())).securityContexts(securityContexts()); + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.wms.api"))// 此包路径下的类,才生成接口文档 + .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))// 加了ApiOperation注解的类,才生成接口文档 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build() + .securitySchemes(Collections.singletonList(securityScheme())) + .securityContexts(securityContexts()); // .globalOperationParameters(setHeaderToken()); } @@ -68,7 +72,7 @@ public class Swagger3Config implements WebMvcConfigurer { */ @Bean SecurityScheme securityScheme() { - return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header"); + return new ApiKey("TOKEN", "token", "header"); } /** @@ -88,7 +92,7 @@ public class Swagger3Config implements WebMvcConfigurer { .title("华恒仓储管理系统API接口文档") // 版本号 .version("1.0") -// .termsOfServiceUrl("NO terms of service") +// .termsOfServiceUrl("NO terms of service") // 描述 .description("后台API接口").license("The Apache License, Version 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").build(); } @@ -97,7 +101,7 @@ public class Swagger3Config implements WebMvcConfigurer { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; - return Collections.singletonList(new SecurityReference(CommonConstant.X_ACCESS_TOKEN, authorizationScopes)); + return Collections.singletonList(new SecurityReference("TOKEN", authorizationScopes)); } }