当前位置:网站首页>【问题解决】ibatis.binding.BindingException: Type interface xxDao is not known to the MapperRegistry.
【问题解决】ibatis.binding.BindingException: Type interface xxDao is not known to the MapperRegistry.
2022-07-25 12:13:00 【宋丹敏】
问题描述:
org.apache.ibatis.binding.BindingException: Type interface com.kuang.dao.UserDao is not known to the MapperRegistry.
MapperRegistry不知道UserDao。
原因:
XXXDaoMapper.xml写了之后,没有在mybaits-config.xml配置文件中注册mapper,
没有注册mapper,写的 XXXDaoMapper.xml就不能实现XXXDao,因为他们之间没有进行绑定,
说白了,XXXDaoMapper.xml 就是 XXXDao.java中接口的实现类,
原来写实现类,是通过 xxxDaoImpl.java类 implement dao层的接口,从而实现绑定的,现在通过namespace来实现绑定
解决办法:
mybaits-config.xml中加入:
<mappers>
<mapper resource="com/kuang/dao/UserMapper.xml"></mapper>
</mappers>

日志:
org.apache.ibatis.binding.BindingException: Type interface com.kuang.dao.UserDao is not known to the MapperRegistry.
at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:732)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:292)
at com.kuang.dao.UserDaoTest.test(UserDaoTest.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
边栏推荐
- Interviewer: "classmate, have you ever done a real landing project?"
- R language ggplot2 visualization: use the ggviolin function of ggpubr package to visualize the violin graph, set the add parameter to add jitter data points and mean standard deviation vertical bars (
- 循环创建目录与子目录
- Leetcode 0133. clone diagram
- I register the absolutely deleted data in the source sqlserver, send it to maxcomputer, and write the absolute data when cleaning the data
- 【七】图层显示和标注
- MySQL练习二
- 启牛开的证券账户安全吗?是怎么开账户的
- Can flinkcdc import multiple tables in mongodb database together?
- 【7】 Layer display and annotation
猜你喜欢
随机推荐
【Flutter -- 布局】层叠布局(Stack和Positioned)
Selenium uses -- XPath and analog input and analog click collaboration
logstash
What does the software testing process include? What are the test methods?
感动中国人物刘盛兰
SSTI template injection vulnerability summary [bjdctf2020]cookie is so stable
Ansible
Does MySQL have flush privileges
【AI4Code】《InferCode: Self-Supervised Learning of Code Representations by Predicting Subtrees》ICSE‘21
请问一下,使用数据集成从postgreSQL导数据到Mysql数据库,有部分数据的字段中出现emoj
推荐系统-协同过滤在Spark中的实现
WPF project introduction 1 - Design and development of simple login page
【7】 Layer display and annotation
Detailed explanation of flex box
919. 完全二叉树插入器 : 简单 BFS 运用题
More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural
485通讯( 详解 )
状态(State)模式
Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network
intval md5绕过之[WUSTCTF2020]朴实无华








