SpringBoot获取指定Resource下的文件
时间:2020-11-19 00:23:58
收藏:0
阅读:199
加入依赖
<dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.8.0</version> </dependency>
具体代码
import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.Resource; @Value("classpath:test.json") Resource resource; List<String> stringList = IOUtils.readLines(resource.getInputStream()); System.out.println(stringList);
原文:https://www.cnblogs.com/chenyanbin/p/14002588.html
评论(0)