org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

在整合spring+mybatis时,运行项目请求业务时,出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.tiandh.dao.UserMapper.selectByPrimaryKey错误,即:找不到Mapper文件

原因:

在target输入目录下只有.java文件,没有 xxxMapper.xml文件

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

解决方案:

在pom.xml文件下<build>节点下添加以下内容

<resources>
  <resource>
    <directory>src/main/java</directory>
    <includes>
      <include>**/*.xml</include>
      <include>**/*.properties</include>
    </includes>
    <filtering>false</filtering>
  </resource>
</resources>

OK!!!问题解决

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)