springboot+mybatis项目 resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]

在用eclipse运行springboot+mybatis过程中报错信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'raceController': Unsatisfied dependency expressed through field 'raceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'raceServiceImp': Unsatisfied dependency expressed through field 'raceDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'IRaceDao' defined in file [D:\STSworkspace\cms\target\classes\com\example\cms\dao\IRaceDao.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.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 16; 文档根元素 "configuration" 必须匹配 DOCTYPE 根 "mapper"

解决方法:

我的目录结构是
在这里插入图片描述
是application.properties的mybatis配置出的问题

mybatis.type-aliases-package=com.example.cms.bean
mybatis.mapper-locations=classpath:com/example/cms/mapper

mybatis.config-location=classpath:mybatis-config.xml

只用加上面两条配置就好了,把location注释掉就能运行了

  • 1
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:1024 设计师:我叫白小胖 返回首页
评论

打赏作者

a-zack

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值