springboot项目打成jar包以后,业务需求想把页面放到jar包外部,方便后续的替换等操作。

1.在配置文件中添加配置
关于springboot集成thymeleaf模板指向外部页面的问题
spring.mvc.static-path-pattern=/**
spring.mvc.view.prefix=/
#配置静态资源,相对路径,必须和jar包在同一目录,file后面的.要写,要写,要写,重要的事说3遍
spring.resources.static-locations=file:./templates/
#配置html资源,相对路径,必须和jar包在同一目录,file后面的.要写,要写,要写,重要的事说3遍
spring.thymeleaf.prefix=file:./templates/
#后缀说明是html页面
spring.thymeleaf.suffix=.html
#是否使用缓存
spring.thymeleaf.cache=false

本地路径如图:java -jar ***.jar 启动jar包即可 关于springboot集成thymeleaf模板指向外部页面的问题

相关文章:

  • 2021-07-27
  • 2022-12-23
  • 2021-07-09
  • 2021-06-13
  • 2022-12-23
  • 2021-11-03
  • 2021-10-21
  • 2021-10-15
猜你喜欢
  • 2021-08-22
  • 2022-12-23
  • 2021-11-18
  • 2021-10-25
  • 2021-08-25
  • 2021-10-05
相关资源
相似解决方案