百木园-与人分享,
就是让自己快乐。

SpringBoot集成Thymeleaf发送Html邮件报错

由于业务需求需要使用Thymeleaf作为模板发送Html邮件,开发调试过程中发生以下错误
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [assist_notice.html], template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1059) at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1048)

开始以为是Classpath下不存在这个文件或者解析时候传入参数不对等等原因,排查了半天各种办法都尝试了,最后灵机一动发现是一个十分弱智的原因:

没有配置Thymeleaf的参数。。。

点击查看代码
spring:  
   thymeleaf:
     cache: false
     prefix: classpath:/template/
     mode: LEGACYHTML5

将以上配置加到nacos中application-xxx.yml配置中就好了,事实证明有的时候不要把简单问题复杂化,忽略可能最基本的点,所谓灯下黑;还有不要太相信堆栈错误log中的信息,有可能驴唇不对马嘴。


来源:https://www.cnblogs.com/hardrockwu/p/16392730.html
本站部分图文来源于网络,如有侵权请联系删除。

未经允许不得转载:百木园 » SpringBoot集成Thymeleaf发送Html邮件报错

相关推荐

  • 暂无文章