Mybatis-plus——org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean

错误信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.atguigu.mybatis_plus.MybatisPlusApplicationTests’: Unsatisfied dependency expressed through field ‘userMapper’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.atguigu.mybatis_plus.mapper.UserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
在这里插入图片描述
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.atguigu.mybatis_plus.mapper.UserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
在这里插入图片描述

他说找不到我哪个类,我觉得可能是ioc出了问题,但是我已经加了spring的注解
在这里插入图片描述

解决:

实际是Mybatis-plus没有找到我的类路径,需要在启动类中加@MapperScan(“com.atguigu.mybatis_plus.mapper”)
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 根据你提供的引用内容,出现这个错误是因为Spring应用程序上下文启动失败,具体的错误信息是`org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentationPluginsBootstrapper'`。中给出了解决方法,可能是因为在依赖中同时引入了Mybatis和Mybatis-plus,导致冲突。你可以尝试解决冲突,选择其中一个依赖来使用。同时,还要检查父模块是否已经引入了Mybatis依赖,而后在本模块又引入了Mybatis-plus模块,这种情况也可能会导致冲突。希望这些信息对你有帮助。123 #### 引用[.reference_title] - *1* [springBoot 启动之后报错Unsatisfied dependency expressed through field ‘baseMapper’](https://blog.csdn.net/borderhz/article/details/117173034)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *2* *3* [org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean](https://blog.csdn.net/Faker_News/article/details/111710850)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] [ .reference_list ]

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

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值