From 81d9524e35c948fd02a7eb9dc82935fc136b60cb Mon Sep 17 00:00:00 2001 From: Coufran Date: Sun, 4 Sep 2022 08:49:40 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A9=E7=94=A8Spring=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=97=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E3=80=90classpath*:=E3=80=91=E6=94=AF=E6=8C=81=20=E5=88=A9?= =?UTF-8?q?=E7=94=A8Spring=E8=AF=BB=E5=8F=96=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E5=A2=9E=E5=8A=A0=E3=80=90classpath*:?= =?UTF-8?q?=E3=80=91=E6=94=AF=E6=8C=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spring的PathMatchingResourcePatternResolver支持【classpath:】和【classpath*:】两种开头的路径,但是SpringPathContentParser将【classpath*:】开头的路径拦截并修改了。 修改后,判断如果以【classpath*:】开头,也不修改,保持原样。 Signed-off-by: Coufran --- .../yomahub/liteflow/spi/spring/SpringPathContentParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java b/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java index 569a25cc2..c7196f4b2 100644 --- a/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java +++ b/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java @@ -11,6 +11,7 @@ import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.spi.PathContentParser; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.util.ResourceUtils; import java.util.ArrayList; @@ -33,7 +34,7 @@ public class SpringPathContentParser implements PathContentParser { if (FileUtil.isAbsolutePath(path) && FileUtil.isFile(path)){ locationPattern = ResourceUtils.FILE_URL_PREFIX + path; } else { - if (!path.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) { + if (!path.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX) && !path.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX)) { locationPattern = ResourceUtils.CLASSPATH_URL_PREFIX + path; }else{ locationPattern = path;