当前位置:网站首页>【问题解决】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)
边栏推荐
- 【十】比例尺添加以及调整
- Leetcode 1184. distance between bus stops
- More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural
- 论文解读(MaskGAE)《MaskGAE: Masked Graph Modeling Meets Graph Autoencoders》
- A method to prevent SYN flooding attacks -- syn cookies
- 【九】坐标格网添加以及调整
- Does MySQL have flush privileges
- Want to go whoring in vain, right? Enough for you this time!
- Pytorch project practice - fashionmnist fashion classification
- Introduction to the scratch crawler framework
猜你喜欢

The first scratch crawler

WPF project introduction 1 - Design and development of simple login page

Analysis of TCP packet capturing using Wireshark

Pytorch project practice - fashionmnist fashion classification

Kyligence 入选 Gartner 2022 数据管理技术成熟度曲线报告

Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?

WPF项目入门1-简单登录页面的设计和开发

想要做好软件测试,可以先了解AST、SCA和渗透测试

Detailed explanation of flex box

919. Complete binary tree inserter: simple BFS application problem
随机推荐
I register the absolutely deleted data in the source sqlserver, send it to maxcomputer, and write the absolute data when cleaning the data
状态(State)模式
Crawler crawls dynamic website
2022.07.24 (lc_6126_design food scoring system)
【AI4Code】《Contrastive Code Representation Learning》 (EMNLP 2021)
PyTorch主要模块
想要白嫖正则大全是吧?这一次给你个够!
【十】比例尺添加以及调整
【高并发】通过源码深度分析线程池中Worker线程的执行流程
Kyligence was selected into Gartner 2022 data management technology maturity curve report
Azure Devops(十四) 使用Azure的私有Nuget仓库
More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural
Plus SBOM: assembly line BOM pbom
R language ggplot2 visualization: visualize the scatter diagram, add text labels to some data points in the scatter diagram, and use geom of ggrep package_ text_ The repl function avoids overlapping l
【2】 Grid data display stretch ribbon (take DEM data as an example)
Ansible
技术管理杂谈
水博士2
Create directories and subdirectories circularly
R language ggpubr package ggarrange function combines multiple images and annotates_ Figure function adds annotation, annotation and annotation information for the combined image, adds image labels fo