enhancement #I4M3Q4 支持配置绝对路径的配置文件

This commit is contained in:
bryan31
2021-12-11 20:58:45 +08:00
parent 4ed094d254
commit 3f453dedd9
17 changed files with 133 additions and 13 deletions

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>com.yomahub</groupId>
<artifactId>liteflow</artifactId>
<version>2.6.6</version>
<version>2.6.6-BETA</version>
</parent>
<dependencies>

View File

@@ -72,10 +72,19 @@ public abstract class FlowParser {
List<Resource> allResource = new ArrayList<>();
for (String path : pathList) {
String locationPattern = path;
if (!locationPattern.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
locationPattern = ResourceUtils.CLASSPATH_URL_PREFIX + locationPattern;
String locationPattern;
//如果path是绝对路径且这个文件存在时我们认为这是一个本地文件路径而并非classpath路径
if (FileUtil.isAbsolutePath(path) && FileUtil.isFile(path)){
locationPattern = ResourceUtils.FILE_URL_PREFIX + path;
} else {
if (!path.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
locationPattern = ResourceUtils.CLASSPATH_URL_PREFIX + path;
}else{
locationPattern = path;
}
}
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources(locationPattern);
if (ArrayUtil.isEmpty(resources)) {