
spring.resources.static-locations无效是因为spring boot配置了拦截器,拦截器的配置把默认处理静态资源的配置给覆盖了,导致失效。拦截器配置如下:

要使 spring.resources.static-locations 生效需要重写 addResourceHandlers(ResourceHandlerRegistry registry),如下图所示:

Spring boot spring.resources.static-locations 无效问题
阅读 71
2022-04-07

spring.resources.static-locations无效是因为spring boot配置了拦截器,拦截器的配置把默认处理静态资源的配置给覆盖了,导致失效。拦截器配置如下:

要使 spring.resources.static-locations 生效需要重写 addResourceHandlers(ResourceHandlerRegistry registry),如下图所示:

相关推荐
精彩评论(0)