Mybatis出现 Invalid bound statement (not found):... 错误原因:
1.检查xml文件所在package名称是否和Mapper interface所在的包名相对应
<mapper namespace="com.test.mapper">
2.注意路径上的空格
3. UserMapper的方法返回值是List<User>,而select元素没有正确配置ResultMap,或者只配置ResultType
4. UserMapper的方法在UserMapper.xml中没有相互对应
5.查看mybatis的配置文件sqlSessionFactory项中mapper的映射路径是否正确
<property name="mapperLocations" value="classpath:com/test/mapper/*.xml"/>
6.如果你是用的idea创建的maven项目,而且将interface文件和xml文件放在java下,那么需要在pom.xml中添加
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
同理properties等文件也可以这样操作。