使用org.reflections扫描具体包中的资源

时间:2017-09-11 18:49:48

标签: java reflection

我正在使用org.reflections library查找资源包中的资源:

new Reflections(
    "test", //package prefix
    new ResourcesScanner()
).getResources(x -> x.endsWith(".xml"))

在添加具有相似名称的包之前,它工作正常。例如
它只是包test并添加了包test_second

| 
+-+-[test]
| +--one.xml
| +--two.xml
|
+-+-[test_second]
  +--three.xml
  +--four.xml

现在,当我尝试按前缀扫描时,会找到两个包中的资源。

问题:如何使用此库仅扫描“test”包中的资源,并忽略所有其他包含“test”前缀的包?

0 个答案:

没有答案