Spring Boot之配置虚拟映射路径

需要先在application.properties属性文件中配置本地上传文件的路径:

spring.http.multipart.location=D:/crowd-funding/media/

然后将本地上传文件的路径加入到静态资源路径中即可:

spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/, classpath:/static/, classpath:/public/, file:${spring.http.multipart.location}

最后访问本地media路径下的文件img.png:

http://localhost:8080/img.png

以上

你可能感兴趣的:(Spring,Boot)