2021-09-01

@[TOC](Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘countDailyUseInfoServiceImpl’: Unsatisfied dependency expressed through field ‘countDailyUseInfoMapper’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘countDailyUseInfoMapper’ defined in file [D:\workIdea\testboot\target\classes\com\example\testboot\dao\CountDailyUseInfoMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\workIdea\testboot\target\classes\mapping\MonthPowerConsumptionMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\workIdea\testboot\target\classes\mapping\MonthPowerConsumptionMapper.xml]’. Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{id], #{areaCounty], #{cityState], #{electricity], #{industryType], #{mYear], #{month], #{createTime}. Check syntax #{property|(expression), var1=value1, var2=value2, …})

mybatis小坑

springboot集成后,一开始写了一个mapper都没错,后面写了6个后在运行就出错了,会报创建bean失败,这里错的实际不是创建失败这个bean,因为启动时候检查了全部了mapper.xml文件,出来问题,所有mapper.xml都读不到,所以代码上就按注入的mapper的顺序来报错。仔细看这个错 #{id], #{areaCounty], #{cityState], #{electricity], #{industryType], #{mYear], #{month],,就可以发现写法出错了,而且是最后那几个mapper.xml中的一个文件里头写错了,改了就好了.。开始一直以为是其他问题,找了半天,而且这段错误在提示中是出现在 警告信息中的,错误信息中没有这样明确详细的问题,只看错误就信息话,很难发现是这里写法出错了!!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值