当前位置:网站首页>【问题解决】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)
边栏推荐
- Implementation of recommendation system collaborative filtering in spark
- 【2】 Grid data display stretch ribbon (take DEM data as an example)
- flinkcdc可以一起导mongodb数据库中的多张表吗?
- 2022河南萌新联赛第(三)场:河南大学 I - 旅行
- Crawler crawls dynamic website
- [rust] reference and borrowing, string slice type (& STR) - rust language foundation 12
- Interviewer: "classmate, have you ever done a real landing project?"
- 请问一下,使用数据集成从postgreSQL导数据到Mysql数据库,有部分数据的字段中出现emoj
- Can't delete the blank page in word? How to operate?
- 我想问DMS有没有定时备份某一个数据库的功能?
猜你喜欢
Software testing interview question: Please list the testing methods of several items?

JS 将伪数组转换成数组

Fiddler抓包APP

Communication bus protocol I: UART

Can't delete the blank page in word? How to operate?

Visualize the training process using tensorboard

基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现

Leetcode 1184. distance between bus stops

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

2022.07.24(LC_6126_设计食物评分系统)
随机推荐
If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
Can flinkcdc import multiple tables in mongodb database together?
Introduction to the scratch crawler framework
【高并发】通过源码深度分析线程池中Worker线程的执行流程
想要白嫖正则大全是吧?这一次给你个够!
mysql实现一张表数据插入另一张表
Spirng @Conditional 条件注解的使用
【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12
Can't delete the blank page in word? How to operate?
[advanced C language] dynamic memory management
If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
R language uses LM function to build multiple linear regression model, step function to build forward stepwise regression model to screen the best subset of prediction variables, and scope parameter t
WPF project introduction 1 - Design and development of simple login page
perf 性能调试
Ansible
【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
3.2.1 what is machine learning?
intval md5绕过之[WUSTCTF2020]朴实无华
【11】 Production and adjustment of vector and grid data Legends
[ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro