Spring Boot 静态资源处理( 六 )


mvc:
static-path-pattern: /image/**
resources:
static-locations: classpath:/images/

static-path-pattern:访问模式 , 默认为/** , 多个可以逗号分隔

static-locations:资源目录 , 多个目录逗号分隔 , 默认资源目录为classpath:/META-INF/resources/classpath:/resources/classpath:/static/classpath:/public/

注意 , 这个配置会覆盖Spring boot默认的静态资源目录 , 例如如果按示例中配置 , 则无法再访问static、public、resources等目录下的资源了 。

推荐阅读