增加配置文件
package com.wisely.upload.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration //@EnableWebMvc public class MyMvcConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { String pathStr = "d:/test/"; System.out.println(pathStr); // registry.addResourceHandler("/xyz/**").addResourceLocations("classpath:/static/"); registry.addResourceHandler("[/]abc/**").addResourceLocations("file:///" + pathStr); // registry.addResourceHandler("/abc/**").addResourceLocations("d:/test/"); } }