由于业务需求需要使用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中的信息,有可能驴唇不对马嘴。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |