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

Spring boot spring.resources.static-locations 无效问题,第1张

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

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

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/733100.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存