解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误

Error message:

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

The general reason is
that the definitions of Mapper interface and xml files do not correspond. It is necessary to check whether the package name, namespace, function name, etc. can correspond.
Perform the following steps one by one:
1. Check whether the package name of the xml file is in one-to-one correspondence with the package name corresponding to the interface
2. Check whether the namespace of the xml file corresponds to the package name of the xml file one-to-one
3. Check whether the function name can be Corresponding to the above
4. Remove the Chinese comments
in the xml file. 5. Add a space or blank line to the xml file and save it.
Note
: When developing with IDEA, if *Mapper.xml is not automatically copied to the mapper of the class output directory when packaging Under the class package, you need to add the configuration of the mybatis load configuration file in the pom file!
as follows:

<build>
  <resources>
    <resource>
        <directory>src/main/java</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
  </resources>
</build>
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

My problem was encountered under IDEA. I added mybatis to load the configuration file in the pom file and then it was solved perfectly. Thanks for the Internet resources~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325949812&siteId=291194637