springboot打包成jar包后访问不到template模板---已经解决解决springboot打成jar包不到模板的问题
⾸先确认,我们的情况是否⼀样?
idea⾥运⾏⼀切正常,打成jar包,⽆法到模板
1. ⾸先看你的controller⾥是不是路径不正确
⽐如return "/page/home"
这样改成"page/home"
2. 再次看模板⽂件是不是抽取了公共部分,⽐如抽取了头部,th标签
如果写的是<head th:replace="/common/common::head"></head>
maven打包本地jar包
改成<head th:replace="common/common::head"></head>
此时⼤多可以解决问题了,如果还不⾏,请看报错提⽰,对应更改.