org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [XXX.xml]‘;

老规矩,先贴一下网上常见的解决方法

1、检查路径是否错误:

2、拼写的sql语句是否有问题:方法名是否等于id?

看看后台输出的sql语句是否正确

select * from register_user or company_name like #{companyName} or user_name like #{userName}

3、如果没有错误,那么去目录搜索这个文件,应该有重复的,删掉target目录下的重复文件,

只保留一个目录的文件即可,然后clear 清空缓存再运行

而我的问题在第四点,错误信息的后面,写着

Could not resolve type alias 'org.mybatis.caches.ehcache.LoggingEhcache'.  Cause: java.lang.ClassNotFoundException: Cannot find class: org.mybatis.caches.ehcache.LoggingEhcache
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586)

看样子问题出在这个看起二级缓存没有关闭上,去xml文件把代码注释掉:

在这里插入图片描述
然后去代码生成的模板里把这个删除
在这里插入图片描述
或者把enableCache设置为false
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值