SpringBoot 遍历资源文件夹 打包后可用
Resource[] resources = ResourcePatternUtils.getResourcePatternResolver(resourceLoader)
.getResources("classpath:decode/*.json");
for(Resource resource: resources){
InputStream inputStream = resource.getInputStream();
String content = new BufferedReader(new InputStreamReader(inputStream))
.lines().collect(Collectors.joining(System.lineSeparator()));
System.out.println(content);
}
需注入resourceLoader