出现上述错误的解决方法

1.检查配置文件
在applicaiton.yml中配置方式应该如图所示

mybatis:
mapper-locations: classpath:mapper/*.xml
*表达任意字符
注意!这里的mapper一定是和mybatis有一个table的距离,否则判断不出来,当然出现下面的情况这样也是正确的
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
mapper-locations: classpath:mapper/*.xml
要注意你mapper所在文件主路径是否和yml中的配置一致,更需要找到他们之间配置的关系。
2.xml配置关系
<?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.bite.mybatisdemo.mapper.UserInfoXMLMapper">
<select id="queryUserInfos" resultType="com.bite.mybatisdemo.model.UserInfo">
select * from userinfo
</select>
</mapper>

查看相关信息是否一 一对应,如果没有则会导致文件互相无法找到
7247

被折叠的 条评论
为什么被折叠?



