springmvc静态资源配置多个location路径,使用逗号隔开 示例: 优先加载文件夹中的assets目录下的资源,如果找不到再到classpath中找
xml配置
<mvc:resources location="/assets/,classpath:/assets/" mapping="/assets/**" />
springboot配置
@Configuration
public class FrontWebMvcConfiguration implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/assets/**")
.addResourceLocations(new String[]{"/assets/","classpath:/assets/"});
}
}