mybatis****报ibatis.binding.BindingException: Invalid bound statement (not found): .selectByExample

编译器:idea

在用mybatis****自动创建文件的时候,运行的时候报这个错:

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

百度了一下大概是以下几种解决方案:

1.mapper.xml映射文件和mapper文件要放在一起

2.在pom.xml中添加以下配置

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

也就是以下位置:↓

mybatis****报ibatis.binding.BindingException: Invalid bound statement (not found): .selectByExample

 

发现这几种解决方案都不行以后,还可以这样检查

mapper.xml文件里的内容是不是重复写了好多遍?

我****插件按了三下,结果mapper.xml文件里居然有3份一模一样的语句

删掉重复的内容以后,运行一下项目报了一basemap的错,好像是叫这个吧,反正就是resultmap的那个id

然后我把resultmap映射删掉,换成了resulttype=“com.xxx.xxx.UserMapper”项目就可以成功运行啦!

是很玄学