thymeleaf在开发环境正常,但用jar运行时报错 Error resolving template template might not exist or might not be accessible

 

通过打包 jar直接运行的

百度搜索此关键词找到的:“springboot jar error resolving template”

 

原因是指向模板的路径前有斜杆/,就会出错,去掉就正常了(路径前不能带斜杆,类似相对路径的写法)

网上有人说增加配置spring.thymeleaf.prefix=classpath:/templates也能解决

 

posted @ 2019-09-11 22:31  由良大小姐  阅读(855)  评论(0编辑  收藏  举报