报错 Type interface *** is not known to the MapperRegistry. 的解决方案

Posted zekeblog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报错 Type interface *** is not known to the MapperRegistry. 的解决方案相关的知识,希望对你有一定的参考价值。

今天我在学习mybatis时碰到了这个报错:org.apache.ibatis.binding.BindingException: Type interface *** is not known to the MapperRegistry.

通过搜索引擎找了很久之后都没能找到解决方案,网上流传的比较多的解决方案是:mapper.xml文件放置到跟接口DAO.java不同名,或者是mapper.xml的namespace没有写对。但是我的错误都不是上述问题。

后来我想了想,我在写完mapper.xml后,还没在config.xml将该mapper.xml配置进来。

 在config.xml中配置好mapper.xml后,项目报错的问题就解决了。

技术分享图片

 

以上是关于报错 Type interface *** is not known to the MapperRegistry. 的解决方案的主要内容,如果未能解决你的问题,请参考以下文章

报错 Type interface *** is not known to the MapperRegistry. 的解决方案

使用Mybatis报错“Type interface com.test.mapper.UserMapper is not known to the MapperRegistry.“

Spring学习的报错____1.Type interface com.xbf.dao.UserDao is not known to the MapperRegistry.

异常 Type interface xx is not known to the MapperRegistry

SpringBoot自定义注解和@Service("..")启动异常报错,Specified class is an interface,求解

Type interface cn.bloghut.dao.UserMapper is not known to the MapperRegistry.