Finding all CLASSPATH resources matching a pattern

前端 未结 4 1646
遥遥无期
遥遥无期 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:34

    Spring supports ant-style class path resource matching.

    http://static.springsource.org/spring/docs/2.5.x/reference/resources.html

    Examples like : classpath:com/mycompany/**/applicationContext.xml, /WEB-INF/*-context.xml

    See if you can use spring for your project. If it is not possible then you can always pull down the source code to see what they are doing, and do that yourself :)

提交回复
热议问题