I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List
The Spring framework
's PathMatchingResourcePatternResolver
is really awesome for these things:
private Resource[] getXMLResources() throws IOException
{
ClassLoader classLoader = MethodHandles.lookup().getClass().getClassLoader();
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(classLoader);
return resolver.getResources("classpath:x/y/z/*.xml");
}
Maven dependency:
org.springframework
spring-core
LATEST