Spring static resource locations¶
In Spring Boot, the locations for serving static resources are derived from the ResourceProperties class within the WebMvcAutoConfiguration configuration^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md].
By default, the framework searches for static resources in four specific classpath locations^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]:
classpath:/META-INF/resources/classpath:/resources/classpath:/static/classpath:/public/
Implementation Details¶
The resource handling mechanism is initialized in the addResourceHandlers method of a configuration class^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]. This method registers resource handlers for the application, utilizing the array of locations defined in ResourceProperties to map URL patterns to physical resource files^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md].
Related Concepts¶
- [[WebMvcAutoConfiguration]]
- [[Webjars]]
Sources¶
^[600-developer-java-spring-thymeleaf-spring-thymeleaf-01.md]