💗wei_shuo的个人主页
💫wei_shuo的学习社区
🌐Hello World !
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory
- 默认类路径在spring-dao.xml
Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring-dao.xml]
- 上下文初始化期间遇到异常 - 取消刷新尝试:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory
- 看报错信息让我检查 com/wei/Mapper/UserMapper.xml
please check com/wei/Mapper/UserMapper.xml and file [D:\Java\Spring_Projects\Spring-10-mybatis\target\classes\com\wei\Mapper\UserMapper.xml]
总结:
得出错误出现在com/wei/Mapper/UserMapper.xml 中
检查UserMapper.xml 发现没有错误,只能去检查映射文件mybatis-config.xml 发现
- UserMapper.xml中写了映射文件class加载方式
<mappers> <mapper class="com.wei.Mapper.UserMapper"/> </mappers>
- 而spring-dao.xml中也书写了映射文件加载方式
<property name="mapperLocations" value="classpath:com/wei/Mapper/*.xml"/>
总结:
两处的映射文件加载方式冲突了,所以系统报错信息才会说defined in class path resource [spring-dao.xml]
🌼 结语:创作不易,如果觉得博主的文章赏心悦目,还请——
点赞
👍收藏
⭐️评论
📝冲冲冲
🤞文章来源:https://www.toymoban.com/news/detail-419328.html
文章来源地址https://www.toymoban.com/news/detail-419328.html
到了这里,关于Exception encountered during context initialization - cancelling refresh attempt的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!