How can I discover resources in a Java jar with a wildcard name?

前端 未结 5 541
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 02:55

I want to discover all xml files that my ClassLoader is aware of using a wildcard pattern. Is there any way to do this?

5条回答
  •  别那么骄傲
    2021-01-18 03:34

     List resources = CPScanner.scanResources(new PackageNameFilter("net.sf.corn.cps.sample"), new ResourceNameFilter("A*.xml"));
    

    put the snippet in your pom.xml

    
        net.sf.corn
        corn-cps
        1.0.1
    
    

提交回复
热议问题