Both Mapper.xml and Mapper.java are present in the project, and the tangent names correspond
I'm used to putting mapper XML and Java in the same directory
On the Internet to see the various methods have failed
1 <?xml version= "1.0" encoding= "UTF-8"?>2 <! DOCTYPE Mapper 3 Public "-//mybatis.org//dtd Mapper 3.0//en"4 "HTTP://MYBATIS.ORG/DTD/MYBATIS-3-MAPPER.DTD" > 5 <mapper namespace= "Mapper" >6 <select id= "finduserbyidmapper" parametertype= "int" Resulttype= "Ssm.po.User" >7 Select *from User where id=#{id}8 </ Select>9 </mapper>
This is changed before the code, the problem is <mapper namespace= "Mapper" > Original mapper Agent developed XML file namespace can not be written, Must use the corresponding Mapper.java of the full path, that is, the CTRL key to go in.
Because the MAVEN build is used, add the following code to the <build></build> tag in Pom.xml
<resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/re Sources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources>
Problem Solving!
Invalid bound statement (not found) with spring and MyBatis integration under MAVEN Engineering: Error