springboot 整合 mvc 配置外部静态资源
1、pc 系统上
1.1、项目是.yml
1.1.1、配置controller 找到 html页面
spring:
thymeleaf:
#关闭缓存
cache: false
#配置前置路径
prefix: file:///D:/pc/front/videoconferencing/
#配置文件后缀
suffix: .html
1.1.2、配置html或者jsp等找到 js 或者css页面
虽然 static-locations 过时了,但还可以用 下面用替换方式
spring.resources 在2.5.5版本已经过时了,需要使用web.resources.static-locations来替换
//已过时 但还可以用
spring:
resources:
static-locations: file:///D:/pc/front/videoconferencing/
//最新版 适合2.5.5以上版本
web:
resources:
static-locations: file:///D:/pc/front/videoconferencing/
1.2、项目是.properties
1.2.1、配置controller 找到 html页面或者其他页面
#关闭缓存
spring.thymeleaf.cache=false
#配置前置路径
spring.thymeleaf.prefix=file:///D:/SQLBackup/sitemanager/
#配置文件后缀
spring.thymeleaf.suffix=.html
1.2.2、配置html或者jsp等找到 js 或者css页面
虽然 static-locations 过时了,但还可以用 下面用替换方式
spring.resources 在2.5.5版本已经过时了,需要使用web.resources.static-locations来替换
#已过时 但还可以用
spring.resources.static-locations= file:///D:/SQLBackup/sitemanager/
#最新版 适合2.5.5以上版本
web.resources.static-locations= file:///D:/SQLBackup/sitemanager/
2、linux 系统上
2.1、项目是.yml
2.1.1、配置controller 找到 html页面
spring:
thymeleaf:
#关闭缓存
cache: false
#配置前置路径
prefix: file:/data/sitemanager/
#配置文件后缀
suffix: .html
2.1.2、配置html或者jsp等找到 js 或者css页面
虽然 static-locations 过时了,但还可以用 下面用替换方式
spring.resources 在2.5.5版本已经过时了,需要使用web.resources.static-locations来替换
//已过时 但还可以用
spring:
resources:
static-locations: file:/data/sitemanager/
//最新版 适合2.5.5以上版本
web:
resources:
static-locations: file:/data/sitemanager/
2.2、项目是.properties
2.2.1、配置controller 找到 html页面或者其他页面
#关闭缓存
spring.thymeleaf.cache=false
#配置前置路径
spring.thymeleaf.prefix=file:/data/sitemanager/
#配置文件后缀
spring.thymeleaf.suffix=.html
2.2.2、配置html或者jsp等找到 js 或者css页面
虽然 static-locations 过时了,但还可以用 下面用替换方式
spring.resources 在2.5.5版本已经过时了,需要使用web.resources.static-locations来替换
#已过时 但还可以用
spring.resources.static-locations= file:/data/sitemanager/
#最新版 适合2.5.5以上版本
web.resources.static-locations= file:/data/sitemanager/
花开一千年,花落一千年,花叶永不见