获取resource目录下的所有文件
比如:想要获取resources/mapper/*.xml 所有的xml文件名
public static void main(String[] args) throws IOException {
PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
org.springframework.core.io.Resource[] resources = pathMatchingResourcePatternResolver.getResources("classpath:mapper/*.xml");
for (org.springframework.core.io.Resource resource : resources) {
System.out.println(resource.getFilename());
}
}
评论区