spring-boot-examples
spring-boot-examples copied to clipboard
spring-boot-file-upload demo上传图片到 "E://temp//" 怎么通过地址访问图片呀?
spring-boot-file-upload demo上传图片到 "E://temp//" 怎么通过地址访问图片呀?
`package com.config;
import org.springframework.beans.factory.annotation.Value; 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 UploadFilePathConfig implements WebMvcConfigurer { // @Value("${file.staticAccessPath}") // private String staticAccessPath; // @Value("${file.uploadFolder}") // private String uploadFolder; @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**").addResourceLocations("file:E:/temp/"); } }`
添加物理路径、虚拟路径映射 也不行啊
http://localhost:8080/dash.png
不能这样访问 走controller的方式请求访问 将图片流写到reponse