1、springboot +mybatis整合时,访问页面报错如下:
2020-10-14 14:35:20.551 ERROR 8668 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "addUser.html": Error resolving template [addUser.html], template might not exist or might not be accessible by any of the configured Template Resolvers
2、在网上找了大半天资料也没有找到,后来反复测试,发现在POM.xml配置文件中加了如下配置信息:
<resource> <directory>src/main/resources</directory> <includes> <include>**/*.yml</include> <include>**/*.properties</include> </includes> </resource>
3、后来把这个resource配置信息去掉后,访问页面就不报错了,但后续整合mybatis时,访问addUser方法时报错
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cw.mapper.UserMapper.insert
4、最后没办法,又把resource配置信息添加上,反复测试后,添加了配置信息<include>**/*.html</include>,就没有如上报错信息,具体原因没查,如果需要的话,自查吧,希望这个能帮助你。
<resource> <directory>src/main/resources</directory> <includes> <include>**/*.yml</include> <include>**/*.html</include> <include>**/*.properties</include> </includes> </resource>