zl程序教程

您现在的位置是:首页 >  后端

当前栏目

mybatis报错Type interface xxx.Dao is not known to the MapperRegistry

mybatis 报错 to The not is type xxx
2023-09-14 08:57:40 时间

今天在做mybatis的时候,遇到一个错误,大家看看这个错误吧:org.apache.ibatis.binding.BindingException: Type interface cn.mybatis_chop10_1.dao.IEmpDao is not known to the MapperRegistry.

我前找找后找找,就是找不出来,上网也没有找到具体的解决方式,于是,我就开始从mybatis-config.xml 到dao,再到Mapper.xm里面一句一句的看,直到我看到:

<mapper namespace="cn.mybatis_chop10_1.dao.EmpMapper">

这一行的时候,瞬间恍然大悟,原来是后面的EmpMapper写错了,把它改掉就行,比如我的是:

<mapper namespace="cn.mybatis_chop10_1.dao.IEmpDao">

在此告诉下大家,一定要细心,细心,再细心!!!尤其是重命名或者Ctrl+C,Ctrl+V的时候,格外注意!!!

最后在推荐一篇:mybatis反向生成实体类,dao层,Mapper:点击这里