In the Spring Boot's docs here, about serving static content, it says:
By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath.
I found that all the content in the directory:
src/main/resources
will be copied inside the classpath, so I can put my static content in:
src/main/resources/static
and all will work fine and I'm happy since I can have my static content under the src
directory.
But, I have some questions about this:
- Why the documentation doesn't say to put static content in
src/main/resources/static
instead of speaking about the classpath (I think this is a bit confusing)? - Is it good to assume that the content in
src/main/resources/
will be always copied in the classpath? - Is there some Spring Boot official documentation explaining what I'm supposed to find in the classpath other than Java classes and packages (up to now I only know I can found all the content from
src/main/resources/
)?
/src/main/resources
it is not strictly related with Spring Boot, since now I have to remember that if I start a Spring Boot project with another build tool instead of Maven (maybe Gradle?) the project could not works if I put static content in/src/main/resources
.. :/ – Charentemaritime