Java教程

springboot 学习(七) springboot静态资源路径

本文主要是介绍springboot 学习(七) springboot静态资源路径,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

springboot中静态资源的存放位置在以下几个路径中:

"classpath:/META-INF/resources/"

"classpath:/resources/"

"classpath:/static/"

"classpath:/public/"

 

同时我们也可以自定义静态资源:

application.properties配置文件修改:

spring.resources.static-locations=classpath:/coding/,classpath:/kuang/

 

首页资源路径:

在以上的静态资源路径下的index.xml文件

 

网站图标设置:

与其他静态资源一样,Spring Boot在配置的静态内容位置中查找 favicon.ico。如果存在这样的文件,它将自动用作应用程序的favicon

但要在application.properties配置文件中:

#关闭默认图标
spring.mvc.favicon.enabled=false

 

这篇关于springboot 学习(七) springboot静态资源路径的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!