springboot资源目录下的几种静态目录,
/META-INF/resources
resources
static
public
application.yml
spring:
mvc:
static-path-pattern: /**
resources:
static-locations: classpath:/test/,classpath:/static/js/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
static-path-pattern,这个配置项是告诉springboot,应该以什么样的方式去寻找资源。默认配置为 /* 。换句话说,只有静态资源满足什么样的匹配条件,Spring Boot才会处理静态资源请求,我们也可配置成 /user/**,这样我们必须输入/user/index.html才能访问到这些目录下的资源,
spring.resources.static-locations,这个配置项是告诉springboot去哪找资源,根据前后关系确定优先级,也就是说如果/META-INF/resources/目录和/resources都有一个index.html,那么根据默认的优先级,会去访问/test/下的资源