Cannot read file within jar file

前端 未结 3 661
半阙折子戏
半阙折子戏 2021-01-22 06:13

I developped an application using spring-boot, I need to read a csv file that contain emails.

this is a snippet how I do:

public Set readFile         


        
3条回答
  •  再見小時候
    2021-01-22 06:52

    I do not work with Spring, but I found the Javadoc of ClassPathResource that states:

    Supports resolution as java.io.File if the class path resource resides in the file system, but not for resources in a JAR. Always supports resolution as URL.

    try with getURL() instead of getFile().

提交回复
热议问题