Spring Boot1.x_jar包的项目 对静态资源的映射规则
一,如果项目是Jar包 的项目,资源都是Jar包引入项目,如bootstrap, jquery等(可在Pom.xml文件中引入webjar),所有以 /webjars/** ,都去classpath:/META-INF/resources/webjars/ 找资源
Juqery为例
1,pom.xml 引入的 webjar
<!--引入jquery-webjar--> <!--在访问的时候只需要写webjars下面资源的名称即可--> <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>3.3.1</version> </dependency>
2,地址

3,在项目中的目录

4,访问路径:localhost:8080/webjars/jquery/3.3.1/jquery.js
二, /** 访问当前项目的任何资源,都去(静态资源的文件夹)找映射
"classpath:/META-INF/resources/",
"classpath:/resources/",
"classpath:/static/",
"classpath:/public/"
"/":当前项目的根路径
如:
欢迎页; 静态资源文件夹下的所有index.html页面;被"/**"映射;
localhost:8080/ 找index页面
所有的 **/favicon.ico 都是在静态资源文件下找;

浙公网安备 33010602011771号