0
点赞
收藏
分享

微信扫一扫

Exception encountered during context initialization - cancelling refresh attempt


Exception encountered during context initialization - cancelling refresh attempt_bug

💗wei_shuo的个人主页

💫wei_shuo的学习社区

🌐Hello World !

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory

Exception encountered during context initialization - cancelling refresh attempt_intellij-idea_02

• 默认类路径在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]

Exception encountered during context initialization - cancelling refresh attempt_bug_03


Exception encountered during context initialization - cancelling refresh attempt_intellij-idea_04

🌼 结语:创作不易,如果觉得博主的文章赏心悦目,还请——点赞👍收藏⭐️评论📝冲冲冲🤞

Exception encountered during context initialization - cancelling refresh attempt_spring_05


举报

相关推荐

0 条评论