0
点赞
收藏
分享

微信扫一扫

Spring boot spring.resources.static-locations 无效问题

ZSACH 2022-04-07 阅读 64
java后端

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

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

举报

相关推荐

0 条评论