SpringBoot中如何配置和使用静态资源与模板引擎?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1332个文字,预计阅读时间需要6分钟。
七、静态资源与模板引擎7.1、默认静态资源映射Spring Boot 默认从名为 /static(或 /public、/resources 或 /META-INF/resources)的目录中提供静态内容。
七、静态资源和模板引擎 7.1、 静态资源映射7.1.1、默认映射By default, Spring Boot serves static content from a directory called
/static(or/publicor/resourcesor/META-INF/resources) in the classpath or from the root of theServletContext.
官方文档告诉我们 Spring Boot 对于静态资源的映射目录是 /static , /public , /resources 以及 /META-INF/resource。除此之外其实还映射了 /webjars/** 到 classpath:/META-INF/resources/webjars。
很明显此处是自动配置实现的,通过查看源码分析这段配置。
而对于网站图标,Spring Boot 也已经配置了默认位置,可以在看到。
本文共计1332个文字,预计阅读时间需要6分钟。
七、静态资源与模板引擎7.1、默认静态资源映射Spring Boot 默认从名为 /static(或 /public、/resources 或 /META-INF/resources)的目录中提供静态内容。
七、静态资源和模板引擎 7.1、 静态资源映射7.1.1、默认映射By default, Spring Boot serves static content from a directory called
/static(or/publicor/resourcesor/META-INF/resources) in the classpath or from the root of theServletContext.
官方文档告诉我们 Spring Boot 对于静态资源的映射目录是 /static , /public , /resources 以及 /META-INF/resource。除此之外其实还映射了 /webjars/** 到 classpath:/META-INF/resources/webjars。
很明显此处是自动配置实现的,通过查看源码分析这段配置。
而对于网站图标,Spring Boot 也已经配置了默认位置,可以在看到。

