Spring Boot read file on heroku
Spring Boot will fail with "getResource()" method to read the file in as on heroku it probably inside of a JAR file, which means it is not a regular file, and must be read as an input stream:
MyService.class.getClassLoader()
.getResource("FILENAME.txt");
MyService.class.getClassLoader()
.getResourceAsStream("FILENAME.txt");
Comments
Post a Comment