码上敲享录 > SpringBoot常见问题详解 > springboot在配置文件中配置虚拟路径spring.resources.static-locations

springboot在配置文件中配置虚拟路径spring.resources.static-locations

上一章章节目录下一章 2021-07-22已有942人阅读 评论(0)

springboot在配置文件中配置虚拟路径spring.resources.static-locations


1.首先在配置文件配置本地文件的路径:

filePath=./filepath/preReportUploadAttach


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

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


3.访问配置路径下的文件:如访问img.png

http://localhost:8080/img.png



向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交