diff --git a/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/PlusPaths.java b/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/PlusPaths.java new file mode 100644 index 00000000..199297bc --- /dev/null +++ b/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/PlusPaths.java @@ -0,0 +1,15 @@ +package com.ruoyi.common.doc.config; + +import io.swagger.v3.oas.models.Paths; + +/** + * 单独使用一个类便于判断 解决springdoc路径拼接重复问题 + * + * @author Lion Li + */ +public class PlusPaths extends Paths { + + public PlusPaths() { + super(); + } +} diff --git a/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/SwaggerAutoConfiguration.java b/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/SwaggerAutoConfiguration.java index 6e71798e..63023cba 100644 --- a/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/SwaggerAutoConfiguration.java +++ b/ruoyi-common/ruoyi-common-doc/src/main/java/com/ruoyi/common/doc/config/SwaggerAutoConfiguration.java @@ -110,7 +110,10 @@ public class SwaggerAutoConfiguration { // 对所有路径增加前置上下文路径 return openApi -> { Paths oldPaths = openApi.getPaths(); - Paths newPaths = new Paths(); + if (oldPaths instanceof PlusPaths) { + return; + } + PlusPaths newPaths = new PlusPaths(); oldPaths.forEach((k,v) -> newPaths.addPathItem(finalContextPath + k, v)); openApi.setPaths(newPaths); };