springboot 整合 mvc 配置外部静态资源

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/





花开一千年,花落一千年,花叶永不见

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值