spring boot 集成 mybatis 单元测试Dao层 控制台报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
最近帮同学做毕业程序,采用后端spring boot + mybatis + H2,将框架搭好进行各层的单元测试时,在dao层就出现了错,如图

于是在网上找各种资料,有的说是xml文件和接口没有一一对应,有的说改maven中的配置,反正小编是没有成功过。
解决方法:在application.properties添加一句,指定xml文件的位置即可,这里小编是放在resources文件下的
mybatis.mapper-locations=classpath:/mybatis/*Mapper.xml
最后贴一张成功图


浙公网安备 33010602011771号