项目中有两个静态文件目录:static,templates
static图片,css,js等资源 templates主要保存模板。
1.放一个文件
2.在yml文件中配置
spring:
mvc:
static-path-pattern: /static/**
默认的静态文件访问目录:
Classpath:/META-INF/resources a.png A
Classpath:resources a.png B
Classpath:static
Classpath:public
他们有一个优先级:
/META-INF/resources>resources>static>public