当前位置:网站首页>【问题解决】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)
边栏推荐
- PyTorch项目实战—FashionMNIST时装分类
- Pytorch environment configuration and basic knowledge
- R language Visual scatter diagram, geom using ggrep package_ text_ The rep function avoids overlapping labels between data points (set the min.segment.length parameter to inf and do not add label segm
- 想要做好软件测试,可以先了解AST、SCA和渗透测试
- 3.2.1 what is machine learning?
- R language uses the ggarrange function of ggpubr package to combine multiple images, and uses the ggexport function to save the visual images in JPEG format (width parameter specifies width, height pa
- The first scratch crawler
- 【九】坐标格网添加以及调整
- 2022.07.24(LC_6126_设计食物评分系统)
- Communication bus protocol I: UART
猜你喜欢

Microsoft azure and Analysys jointly released the report "Enterprise Cloud native platform driven digital transformation"

【AI4Code】《Contrastive Code Representation Learning》 (EMNLP 2021)

阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?

485通讯( 详解 )

Azure Devops (XIV) use azure's private nuget warehouse

JS convert pseudo array to array
Software testing interview question: Please list the testing methods of several items?
![[ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro](/img/a2/9b676d0f1b33cc7d413cee6c52d76d.png)
[ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro

LeetCode 0133. 克隆图
![[fluent -- example] case 1: comprehensive example of basic components and layout components](/img/d5/2392d9cb8550aa2692c8b41303d507.png)
[fluent -- example] case 1: comprehensive example of basic components and layout components
随机推荐
Introduction to the scratch crawler framework
【AI4Code】《InferCode: Self-Supervised Learning of Code Representations by Predicting Subtrees》ICSE‘21
【三】DEM山体阴影效果
PyTorch项目实战—FashionMNIST时装分类
软件测试流程包括哪些内容?测试方法有哪些?
Crawler crawls dynamic website
JS 中根据数组内元素的属性进行排序
我想问DMS有没有定时备份某一个数据库的功能?
Deep learning MEMC framing paper list
Spirng @Conditional 条件注解的使用
485通讯( 详解 )
MySQL implements inserting data from one table into another table
“蔚来杯“2022牛客暑期多校训练营2 补题题解(G、J、K、L)
【8】 Clever use of color finder
2022.07.24 (lc_6124_the first letter that appears twice)
Dr. water 2
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
Create directories and subdirectories circularly
LeetCode 1184. 公交站间的距离
PyTorch进阶训练技巧