1.出现下面错误的:
Mapped Statements collection does not contain value for com.lsy.mapper.UsersMapper.selectUsersAll
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.lsy.mapper.UsersMapper.selectUsersAll
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.lsy.mapper.UsersMapper.selectUsersAll
原因之一:
mapper namespace 写错文件名:
mapper.xml文件中的UsersMapper写成了UserMapper
正确写法如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lsy.mapper.UsersMapper">
<select id="selectUsersAll" resultType="com.lsy.pojo.Users">
select * from users
</select>
</mapper>