IDEA中Spring Boot项目MyBaits提示Invalid bound statement (not found)错误

一个SpringBoot项目在STS中是正常的,没有任何问题,但是导入到IDEA中之后启动就提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误

2017-05-01 20:29:30.089 ERROR 8580 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): hellowood.lntu.oe.wmp.dao.FeedbackDetailMapper.insertSelective] with root causeorg.apache.ibatis.binding.BindingException: Invalid bound statement (not found): ...........

该错误提示没有找到相对应的XML文件,找了很长时间发现在编译后的classes路径下并没有相应的XML文件,这是因为IDEA在编译的时候忽略掉了XML文件,一个解决方法是将所有的XML文件移动到Resource文件夹下,这样在编译的时候就会将XML文件一起

  • 移动文件夹后修改配置文件中的MyBat的扫描路径
 mybatis.mapper-locations=classpath*:/mapper/**Mapper.xml
    • 修改前的结构 
      修改前的结构

    • 修改后的结构 
      修改后的结构

为人:谦逊、激情、博学、审问、慎思、明辨、 笃行
学问:纸上得来终觉浅,绝知此事要躬行
为事:工欲善其事,必先利其器。
态度:道阻且长,行则将至;行而不辍,未来可期
转载请标注出处!
原文地址:https://www.cnblogs.com/ios9/p/14581544.html