简体   繁体   中英

Cannot get path of file in resources folder in Spring Boot

In my Spring Boot app, I have a csv file called team.csv in the resources folder. I need to get its path properly to pass to Files.newBufferedReader() method and tried something as shown below, but cannot get path properly. So, how can I get and use it in the following method?

Reader reader = Files.newBufferedReader(Paths.get("classpath:team.csv"));

or if you wante to get a BufferedInputStream new BufferedInputStream(this.getClass().getResourceAsStream("/rep/doc.txt"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM