From be37190c093c45e6c9c8b6c95edd3d1355aee9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 7 Sep 2022 14:50:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20openapi=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BD=93=20=E5=9B=A0springdoc=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=A4=9A=E6=AC=A1=E6=8B=BC=E6=8E=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/framework/config/SwaggerConfig.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 204195b4..7107661c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -95,10 +95,25 @@ public class SwaggerConfig { // 对所有路径增加前置上下文路径 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); }; } + /** + * 单独使用一个类便于判断 解决springdoc路径拼接重复问题 + * + * @author Lion Li + */ + static class PlusPaths extends Paths { + + public PlusPaths() { + super(); + } + } + }