Reputation: 412
I need to access the files I have in /src/main/resources/static/myfolder in my Spring Boot Controller using the java.io.File API. I tried
File folder = new File("/myfolder/");
But it doesn't work. Any ideas?
Upvotes: 2
Views: 1643
Reputation: 2342
This should work
File file = new File(getClass().getResource("/static/myfolder").getFile());
File[] files = file.listFiles();
Upvotes: 4