Spring boot spring.resources.static-locations 无效问题
spring.resources.static-locations无效是因为spring boot配置了拦截器,拦截器的配置把默认处理静态资源的配置给覆盖了,导致失效。拦截器配置如下:
要使 spring.resources.static-locations 生效需要重写 addResourceHandlers(ResourceHandlerRegistry registry),如下图所示: