springboot 读取外部文件

external location for image store in Spring Boot 2.0 web app?

之前有个需求是需要有个urlpatren像 staticFiles/xxx.pdf 请求的url 对应服务器端的某个文件夹可以直接访问,

WebMvcConfigurer 需要实现或者继承WebMvcConfigurerAdapter

@Configurationpublic class MvcConfig extends WebMvcConfigurerAdapter  {    @Override    public void addResourceHandlers(ResourceHandlerRegistry registry) {       registry               .addResourceHandler("/btrm/framework/item/static/**")               .addResourceLocations("file:D:\\SVNCODE\\btrm\\")               .setCachePeriod(200);        super.addResourceHandlers(registry);    }}