ResourcePatternResolver获取资源的绝对路径,可以用来加载类文件
PathMatchingResourcePatternResolver是该接口的实现类
使用方法:
String pattern = "classpath:/com/soft/lib/**/*.class";//路径匹配规则
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources(pattern);
//获取资源路径
for(Resource i : resources){
System.out.print(i.getURL().toString());
}