当前位置:网站首页>Resolve the error: org.apache.ibatis.binding.bindingexception
Resolve the error: org.apache.ibatis.binding.bindingexception
2022-07-25 02:51:00 【young_ man2】
Project scenario :
I'm learning mybatis This problem occurred during the agent development of
Problem description
I'm learning today mybatis There was a mistake :
Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.wxy.dao.UserMapper 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:745)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:292)
at com.wxy.service.ServiceDemo.main(ServiceDemo.java:31)Cause analysis :
1. We need to know that this sentence means Yours Mapper Interface , By Spring After injection , But it can't be used normally mapper.xml Of sql;
2. there Spring After injection, it means , Your interface has been successfully scanned , But when Spring Try injecting a proxy (MyBatista Realization ) After the implementation class of , But it doesn't work . There are several possible situations here ;
① The interface has been scanned , But the proxy object was not found , Even if you try to inject , Also inject a wrong object ( It could be null)
② The interface has been scanned , Proxy object found , Also injected into the interface , But when calling a specific method , But I can't use ( Maybe other methods are normal )
Solution :
How to solve ?
1. Check your mapping file for namespace Is it consistent with the path of the interface file
For example, the fully qualified name of your interface is com.dao, Class called UserDao, Then in your mapping file namespace The parameter of should be com.dao.UserDao
【 Be careful : The path to direct replication is com/dao/UserDao.java This is not allowed , Only use . Connect 】
2. Check your mapping file for id Is it consistent with the method name in the interface ?
For example, your method is named findAll(), Then in your mapping file id It needs to be findAll
3. Check whether the output of your interface is consistent with yours resultType Agreement ?
Such as your resultType yes user class , Then the output of your interface 【 Suppose the method in your interface is List<xxx> findAll() ;】 That is, here you are xxx Need to be User
Pay attention , I'm going to use User Because I have renamed it in the core configuration file , So if you didn't rename , Yours resultType It needs to be the package name +User, Then your output inside xxx Still User Can , It won't make any difference
Give me a screenshot
① There is no core profile custom alias


② Customize the alias


4. Check the input of your interface and your paramType Is it consistent ?
【 Suppose the method in your interface is List<User> findAll(xxx) ;】, The mapping file is paramType="int", So you have xxx Need to be int i【 This parameter is arbitrary , As long as the parameter type is int Just go 】
I hope it helps you !
I wish you a job soon ! Come on together !
边栏推荐
- Creating elements of DOM series
- 6. Object storage
- Flutter apple native Pinyin keyboard input exception on textfield | Pinyin input process callback problem
- How to communicate with aliens
- How to switch terminators in PostgreSQL?
- Tp5.1 paging (with parameter transfer)
- Wechat sports field reservation of the finished works of the applet graduation project (5) assignment
- Technical experts from large factories: Thoughts on cloud nativity and software supply chain security
- Keil compile download error: no algorithm found for: 08000000h - 08001233h solution
- 【C】 Advanced knowledge of file operation
猜你喜欢
![[TinyML]EfficientFormer:Vision Transformers at MobileNet Speed](/img/e7/b9ecf49721e6304a2d8ca824b64458.png)
[TinyML]EfficientFormer:Vision Transformers at MobileNet Speed

The latest interview questions and analysis of software testing in 2022

Is redis'module'not an internal or external command?

2022-07-19: all factors of F (I): I are added up after each factor is squared. For example, f (10) = 1 square + 2 square + 5 square + 10 square = 1 + 4 + 25 + 100 = 130.

IO (1) -io layering

Flume's study notes

6. Object storage

Use unicloud cloud function to decode wechat motion steps in applet

Arduino IDE for raspberry PI Pico development firmware localization installation tutorial

How to use blender to make 360 degree panorama and panoramic video?
随机推荐
HAC cluster is modified to stand-alone
Do you know about real-time 3D rendering? Real time rendering software and application scenarios are coming
DOM operation -- get elements and nodes
[jailhouse article] certify the uncertified rewards assessment of virtualization for mixed criticality
Generator set work arrangement problem code
Tp5.1 initialize initialization method (not \u initialize)
JS foundation -- JSON
6.0 cancellation of member registration verification code
JS foundation -- math
"Introduction to interface testing" punch in to learn day09: Micro service interface: how to use mock to solve chaotic call relationships
Rolling division, Young's matrix and three-step flip
Can PostgreSQL CDC only connect to the main database? Connection from the library reports an error logical decoden
Please ask a question: how to set the new table of MySQL CDC 2.2.x to only receive increment
@Retryable @backoff @recover retry the use of annotations
How to take the mold for the picture of 1.54 inch TFT st7789 LCD screen
Execution methods with static code blocks and child and parent classes
Pagoda workman WSS reverse proxy socket legal domain name applet chat remove port
YouTube Download and (batch) Download
Three ways to solve your performance management problems
Unity refers to a variable in another class (its own instance)