| | |
| | | * @author wzy |
| | | * @date 2020-04-27 11:54 |
| | | **/ |
| | | @SpringBootConfiguration |
| | | @Slf4j |
| | | @SpringBootConfiguration |
| | | public class WebMvcConfig implements WebMvcConfigurer { |
| | | |
| | | @Override |
| | |
| | | .allowCredentials(true).maxAge(3600); |
| | | } |
| | | |
| | | @Bean |
| | | public SpringContextHolder springContextHolder() { |
| | | return new SpringContextHolder(); |
| | | } |
| | | // @Bean |
| | | // public SpringContextHolder springContextHolder() { |
| | | // System.out.println(111111); |
| | | // return new SpringContextHolder(); |
| | | // } |
| | | |
| | | @Value("${upload.file.location}") |
| | | private String fileLocation; |
| | | @Value("${upload.file.path}") |
| | | private String filePath; |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | //注册配置类,使用addResourceHandlers方法,将本地路径savePath映射到saveUrl路由上。 |
| | | registry.addResourceHandler(filePath).addResourceLocations(fileLocation); |
| | | WebMvcConfigurer.super.addResourceHandlers(registry); |
| | | } |
| | | // @Value("${upload.file.location}") |
| | | // private String fileLocation; |
| | | // @Value("${upload.file.path}") |
| | | // private String filePath; |
| | | // @Override |
| | | // public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | // //注册配置类,使用addResourceHandlers方法,将本地路径savePath映射到saveUrl路由上。 |
| | | // registry.addResourceHandler(filePath).addResourceLocations(fileLocation); |
| | | // WebMvcConfigurer.super.addResourceHandlers(registry); |
| | | // } |
| | | |
| | | } |