您的位置:首页 > 编程语言 > Java开发

Spring Boot之配置虚拟映射路径

2017-11-07 17:36 567 查看
需要先在
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


以上
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: