Mybatis绑定问题 ibatis.binding.BindingException: Type interface xxx is not known to the MapperRegistry

org.apache.ibatis.binding.BindingException: Type interface xxx is not known to the MapperRegistry

绑定异常:MapperRegistry不知道接口类型xxx
在这里插入图片描述

主要的原因,还是出在了没有对mapper进行绑定的问题上
在这里插入图片描述
那么只需要添加上对应位置的Mapper.xml就可以了。例:

<mappers>
	<mapper resource="com/baven/mapper/StudentMapper.xml"/>
</mappers>

当然,也可以用<mapper class="com.baven.mapper.StduentMapper"的方式。
前提要注意:XML文件需要和接口在同一个包下,要不也会报错下方错误


org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): xxx.xxx.xxXXX

出了这个错误,那么就要注意刚才说的,XML文件需要和接口在同一个包下
在这里插入图片描述
有什么问题大佬可以留言,小弟立刻修改。

猜你喜欢

转载自blog.csdn.net/PINKMIAO/article/details/108277966