admin管理员组文章数量:1566679
💗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]
🌼 结语:创作不易,如果觉得博主的文章赏心悦目,还请——
点赞
👍收藏
⭐️评论
📝冲冲冲
🤞
本文标签: ContextencounteredExceptioninitializationattempt
版权声明:本文标题:Exception encountered during context initialization - cancelling refresh attempt 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1726224336a1061325.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论