1 静态资源访问
2 两种方式自定义静态资源访问位置
2.1 方式1
2.2 方式2
package com
.tzb
.config
;
import org
.springframework
.context
.annotation
.Configuration
;
import org
.springframework
.web
.servlet
.config
.annotation
.ResourceHandlerRegistry
;
import org
.springframework
.web
.servlet
.config
.annotation
.WebMvcConfigurer
;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry
) {
registry
.addResourceHandler("/**")
.addResourceLocations("classpath:/mylocation/");
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-52439.html