spring boot linux 指定外部静态资源

来源:互联网 发布:python 判断进程存在 编辑:程序博客网 时间:2024/05/21 22:24

我在配置小程序接口运行程序的时候,遇到小程序需要访问图片资源,但是图片资源在程序包外部,然后翻文档解决这个问题,希望能帮到其他人

在application.properties配置文件中加如下配置

web.upload-path=/data/imgHome/webImg/     外部只要绝对路径

spring.mvc.static-path-pattern=/**

spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}


原创粉丝点击