Reputation: 33
Hello dear Stack Overflow community,
I have a Spring Boot web app that was previously packaged as a WAR file, my static content was placed inside a webapps/resources folder ( apart from thymeleaf templates that were placed inside resources/templates ).
After I converted my project to a JAR I was expecting that my app won't be able to find the static resources, as I've done some research on that and I found out that when packaged as JAR the webapps/resources folder isn't by default in the classpath.
Oddly, Spring was able to locate my static resources and everything works fine.
So the first part of my question is why Spring can find the static resources without any extra configuration?
And the second part is do you think that removing the webapps folder completely and placing the static resources in an other location ( e.g. resources/static ) is a better approach?
NOTE #1: I use no configuration at all for specifying the location of static content inside my app ( I just use the defaults ), so it seems quite unexpected that spring was able to find these files.
NOTE #2: I reference the static content via relative paths in my thymeleaf templates.
Thanks in advance for your time and answers, Spiros.
Upvotes: 3
Views: 1171