Seems like whatever I do I cannot read a file from resources dir in my Spring-boot app.
Any ideas?
Could it be because of the way I call the method to read the file?
@SpringBootApplication
public class DemostoreApplication {
public static void main(String[] args) throws IOException {
SpringApplication.run(DemostoreApplication.class, args);
}
@EventListener(classes = ApplicationStartedEvent.class)
public void applicationStarted() {
loadAFile();
}
void loadAFile(){
InputStream inputStream = getClass().getResourceAsStream("user-data.txt");
}
}
I can see that there are many questions like this one, mostly unanswered. I've tried the propositions in all of them.