spring.mvc.static-path-pattern
代表的含义是我们应该以什么样的路径来访问静态资源,换句话说,只有静态资源满足什么样的匹配条件,Spring Boot才会处理静态资源请求。
spring.resources.static-locations
用于告诉Spring Boot应该在何处查找静态资源文件,这是一个列表性的配置,查找文件时会依赖于配置的先后顺序依次进行。
spring:
application:
name: test
servlet:
multipart:
max-file-size: 500MB
max-request-size: 500MB
mvc:
static-path-pattern: /material/**
resources:
static-locations: file:/opt/oa/enclosure/dispatch,file:/home/version
cn:
chinaunicom:
dispatchEnclosurePath: /opt/oa/enclosure/dispatch
materialLink: http://10.163.76.160:9010/form/material/
配置以上属性,然后将一个图片(例如:1.jpg)和文档(例如:1.doc)放置到服务器/opt/oa/enclosure/dispatch或/home/version目录下,通过项目名http://10.163.76.160:9010/form/material/1.jpg进行在线打开图片,通过项目名http://10.163.76.160:9010/form/material/1.doc进行在线下载文档。
如果被拦截器拦截访问失败情况下选用