Spring Boot之配置虚拟映射路径

来源:互联网 发布:c语言第三版课后答案 编辑:程序博客网 时间:2024/06/14 12:26

需要先在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

以上

原创粉丝点击