Finding all CLASSPATH resources matching a pattern

前端 未结 4 1760
遥遥无期
遥遥无期 2021-02-05 17:24

I want to read a bunch of text files, by loading them as resources using the context classloader.

URL url = Thread.currentThread()
                .getContextCla         


        
4条回答
  •  轮回少年
    2021-02-05 17:30

    You can try corn-cps

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

    Use the dependecy below in your pom.xml

    
        net.sf.corn
        corn-cps
        1.0.1
    
    

提交回复
热议问题