美文网首页
spring boot打包jar 文件上传 如何访问外部资源

spring boot打包jar 文件上传 如何访问外部资源

作者: Morgan7 | 来源:发表于2018-07-03 10:55 被阅读0次

配置

自定义属性

#上传文件路径 
#文件上传到此路径下 springboot 访问磁盘此路径
web:
  upload-path: /Users/xxxx/Downloads

设置静态资源路径

#spring配置
spring:
# spring boot使用外部资源文件
  mvc:
    #所有的访问都经过静态资源路径
    static-path-pattern: /**
  resources:
    #静态资源路径 这里的配置是覆盖默认配置 所以需要重新加上默认配置 否则访问不到 比如css js 
    static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}

重点在于 static-locations

设置默认静态资源路径

相关文章

网友评论

      本文标题:spring boot打包jar 文件上传 如何访问外部资源

      本文链接:https://www.haomeiwen.com/subject/ugjduftx.html