springboot2项目里结合thymeleaf模板引擎发送邮件,发现无法解析自定义的模板文件
application中配置如下
spring.thymeleaf.prefix=file:config/page
这里只配置一个prefix,因为其它配置项默认配置都是对的,这里不需要配置了,可参考
启动调用发现报错如题,最后通过debug找到原因
通过上述类方法,找到最后代码解析的全路径如下
prefix和template name之间少了一个 / 。
更新配置如下
#config thymeleaf
spring.thymeleaf.prefix=file:config/page/
最后加一个 /
问题解决。