Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource
2021/7/10 19:05:52
本文主要是介绍Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
问题原因
在写spring配置文件的时候发现这个问题,根据报错信息发现是在写mybatis的映射文件的时候namespace写错了。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/bjpowernode/dao/StudentDao.xml'. Cause: org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected 'com.bjpowernode.dao.StudentDao' but found 'com.bjpowernode.dao'.
问题解决
主要信息在最后一句,错误的命名空间,本该映射到接口,然而写成了包。
Wrong namespace. Expected 'com.bjpowernode.dao.StudentDao' but found'com.bjpowernode.dao'.
所以在写配置文件时一定要细心。
这篇关于Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-28pyqt 怎么打包整个项目-icode9专业技术文章分享
- 2024-09-28laravel Commands 创建带有参数的 Artisan 命令的步骤和示例-icode9专业技术文章分享
- 2024-09-28antd怎么实现渲染tiff图片-icode9专业技术文章分享
- 2024-09-28英文半角中划线和中文全角的中划线有什么区别-icode9专业技术文章分享
- 2024-09-28nvm npm 和node 他们之间有什么关系-icode9专业技术文章分享
- 2024-09-28Node Version Manager (nvm)使用教程-icode9专业技术文章分享
- 2024-09-28nvm命令太慢,是什么原因-icode9专业技术文章分享
- 2024-09-28Kotlin 如何增加、删除和修改 MutableStateFlow 中的值。-icode9专业技术文章分享
- 2024-09-28Kotlin的stateFlow.update 写法介绍-icode9专业技术文章分享
- 2024-09-28kotlin 怎么获取当前时间格式-icode9专业技术文章分享