From ae6069882fdafb0e806f64ab941caeda14cae1d9 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Thu, 24 Jul 2025 18:36:21 +0800 Subject: [PATCH] =?UTF-8?q?TODO=20=E6=9A=82=E6=97=B6=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8E=89=EF=BC=8Cfor=EF=BC=9A=E3=80=90issues/8638=E3=80=91spri?= =?UTF-8?q?ngboot3=E5=88=86=E6=94=AF=EF=BC=8Cknife4j=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA=E6=96=87=E6=A1=A3=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AFswagger-ui=E5=92=8Cv3/api-docs=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=20#8638?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/config/Swagger3Config.java | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger3Config.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger3Config.java index cae32fe2f..64e6f3fa6 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger3Config.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger3Config.java @@ -10,7 +10,6 @@ import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.constant.CommonConstant; -import org.springdoc.core.customizers.GlobalOpenApiCustomizer; import org.springdoc.core.filters.GlobalOpenApiMethodFilter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -60,30 +59,29 @@ public class Swagger3Config implements WebMvcConfigurer { return method -> method.isAnnotationPresent(Operation.class); } - @Bean - public GlobalOpenApiCustomizer globalOpenApiCustomizer() { - return openApi -> { - // 全局添加鉴权参数 - if (openApi.getPaths() != null) { - openApi.getPaths().forEach((path, pathItem) -> { - //log.debug("path: {}", path); - // 检查当前路径是否在排除列表中 - boolean isExcluded = excludedPaths.stream().anyMatch(excludedPath -> - excludedPath.equals(path) || - (excludedPath.endsWith("**") && path.startsWith(excludedPath.substring(0, excludedPath.length() - 2))) - ); - - if (!isExcluded) { - // 接口添加鉴权参数 - pathItem.readOperations() - .forEach(operation -> - operation.addSecurityItem(new SecurityRequirement().addList(CommonConstant.X_ACCESS_TOKEN)) - ); - } - }); - } - }; - } + //TODO 暂时注释掉,for:【issues/8638】springboot3分支,knife4j不能正确显示文档,但是swagger-ui和v3/api-docs正常 #8638 +// @Bean +// public GlobalOpenApiCustomizer globalOpenApiCustomizer() { +// return openApi -> { +// // 全局添加鉴权参数 +// if (openApi.getPaths() != null) { +// openApi.getPaths().forEach((path, pathItem) -> { +// //log.debug("path: {}", path); +// // 检查当前路径是否在排除列表中 +// boolean isExcluded = excludedPaths.stream().anyMatch( +// excludedPath -> excludedPath.equals(path) || (excludedPath.endsWith("**") && path.startsWith(excludedPath.substring(0, excludedPath.length() - 2))) +// ); +// +// if (!isExcluded) { +// // 接口添加鉴权参数 +// pathItem.readOperations().forEach(operation -> +// operation.addSecurityItem(new SecurityRequirement().addList(CommonConstant.X_ACCESS_TOKEN)) +// ); +// } +// }); +// } +// }; +// } @Bean public OpenAPI customOpenAPI() {