springboot整合mybaits过程当中,调用接口时报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):spring
分析了下报错堆栈信息,认为是找不到*Mapper.xml致使,网上搜索下他人博客,觉得是IDEA致使*Mapper.xml没法生成,因而检查了编译生成的classes目录(classpath),发现*Mapper.xml是存在的,IDEA并无问题。
就在百思不得其解时,仔细检测了下application.yml文件中mybatis的基本配置,大吃一惊,原来本身配置时不当心多了空格缩进,把mybatis的配置加到spring配置属性上了。所以,mybatis配置不生效,致使mybatis扫描不到Mapper.xml文件,所以运行时报“mapper接口与mapper.xml绑定异常”。apache
“mapper接口与mapper.xml绑定异常”的一种缘由,就是mybatis配置有误致使程序找不到mapper.xml文件(即:属性mapperLocations配置有问题),所以报错。springboot