解决Error creating bean with name xxx defined in class path resource [applicationContext.xml]错误
今天使用基于MapperFactoryBean来实现MyBatis与Spring的整合,使用Mapper接口编程,一直报一个错误,调试了很久
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘customerMapper’ defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type ‘java.lang.String’ to required type ‘java.lang.Class’ for property ‘mapperInterface’; nested exception is java.lang.IllegalArgumentException: Cannot find class [mapper.CustomerMapper]
调试了很久,才发现是Mapper接口的名称和对应的Mapper.xml映射文件的名称不一致
在使用Mapper接口编程的方式,需要遵循一些规范
- Mapper接口的名称和对应的Mapper.xml映射文件的名称必须一致
- Mapper.xml文件中的namespace与Mapper接口的类路径相同
- Mapper接口中的方法名和Mapper.xml中定义的每个执行语句的id相同
- Mapper接口中方法的输入参数类型要和Mapper.xml中定义的每个sql的parameterType的类型相同
- Mapper接口方法的输出参数类型要和Mapper.xml中定义的每个sql的resultType的类型相同
解决Error creating bean with name xxx defined in class path resource [applicationContext.xml]错误相关推荐
- Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [applicationContext
学习spring框架时遇到一个问题,找了很久. 记录一个错误, D:\Java\jdk-14.0.2\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1 ...
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
报错信息如下: <span style="font-size:24px;">17:18:32,245 ERROR ContextLoader:307 - Context ...
- 解决Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource...问题
文章目录 1. 复现问题 2. 分析问题 3. 解决问题 1. 复现问题 今天在启动spring boot项目时,出现如下错误: org.springframework.beans.factory.B ...
- 解决 Error creating bean with name ‘dataSource‘ defined in class path resource 问题
报错如下: java.lang.IllegalStateException: Failed to load ApplicationContextat org.springframework.test. ...
- 【J】BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource
在做SSM博客系统的时候遇到以下报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with ...
- 日志Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [applicationConte
logimp报错日志直接看报错的最后一句. 另外bug:namespace="这里面应该用-来分隔,不应该用/",所以这里不应该复制,键盘自己敲 Error creating be ...
- 记一次SpringBoot操作redis报错 Error creating bean with name ‘dataSource‘ defined in class path resource解决方法
代码块 以下为Springboot操作Redis一些简单的测试代码 maven依赖 <dependency><groupId>org.springframework.boot& ...
- Error creating bean with name ‘dataSource‘ defined in class path resource解决
报错信息 ERROR 3592 - [ restartedMain] o.s.boot.SpringApplication : Application run failed org.springfra ...
- 启动springboot报错Error creating bean with name 'dataSource' defined in class path resource
2019独角兽企业重金招聘Python工程师标准>>> 启动springboot报错Error creating bean with name 'dataSource' define ...
最新文章
- 高级工程考试通过总结
- modelsim-altera
- 论文解读:深度监督网络(Deeply-Supervised Nets)
- Ubuntu16.04安装TORCS
- html 一个圆圈一个c,如何用c语言程序画一个圆?
- mysql 回退查询_MySQL数据库:第十章:分页查询
- 【OpenCV 例程200篇】51. 图像增强—直方图反向追踪
- java串口设备中断_利用DMA双缓冲或半完成中断实现串口不定长数据的接收
- 求和(1,2,3.....n使其和为m的所有情况)
- 51单片机外围模块——红外通信
- scipy.linalg中kron的用法
- e430c参数 thinkpad_联想ThinkPad E430c(33651E1)
- Genymotion启动失败解决方案
- 【历史上的今天】1 月 21 日:微软创始人诞生;微信 11 周年;传奇黑客出生
- [架构之路-147]-《软考-系统分析师》- 7-企业信息化战略与实施-4-企业资源规划ERP和实施、信息资源管理
- 【高强度U盘文件夹加密工具】
- 制作dns服务器,宽带提速方法 制作dns服务器提速宽带 -电脑资料
- Python中的 if 语句简单介绍,中英文完整理解
- 键盘键和键盘键控制值一览表(键盘按键对应代码表)
- 从入门到实战,Netty多线程篇案例集锦