java - Spring AntPathMatcher 行为
问题描述
在启动时,我们的应用程序正在调用PathMatchingResourcePatternResolver
以动态发现类路径上的资源。
在 内org.springframework.core.io.support.PathMatchingResourcePatternResolver.doRetrieveMatchingFiles(String, File, Set<File>)
,以下情况永远不会成立:
请注意,我正在从 Eclipse 运行我们的应用程序。
fullPattern
我使用和变量中看到的相同值进行了示例测试currPath
,并且它起作用了。测试如下:
import org.springframework.util.AntPathMatcher;
public class DummyTest {
public static void main(String[] args) {
AntPathMatcher m = new AntPathMatcher();
String pattern = "C:/temp/target/classes/com/test/dummy/**/myFile.xml";
String path = "C:/temp/target/classes/com/test/dummy/anotherRep/myFile.xml";
if(m.match(pattern, path)) {
System.out.println("match");
}
else {
System.out.println("doesn't match");
}
}
}
有谁知道为什么它在我的应用程序上下文中不起作用?
解决方案
推荐阅读
- ios - 后台 URLSession 卡住
- c - 消息队列 mq 发送错误。错误的文件描述符
- reactjs - 当地图或过滤器中没有项目时,我想显示不同的内容
- mysql - Docker-compose 数据库表重置
- python - SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 63-64: truncated \UXXXXXXXX escape
- python - Python 和 JSON | 无法使用索引访问字典
- flutter - Dart 测试:期望流不发射任何内容
- macos - 带有通配符的 zipgrep 以匹配多个文件
- python - 在 python 中读取 qrcode 在终端中显示为空
- python - 插入并执行许多跳过外键约束失败的行