Springboot Error creating bean with name ‘****ServiceImpl‘: Unsatisfied dependency expressed through

Error creating bean with name ‘**ServiceImpl’: Unsatisfied dependency expressed through field ‘Dao’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example..Dao.***Dao’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因是mybatis是自己在pom.xml中添加的,而不是在创建springboot项目时勾选的,所以导致少了几个mybatis整合springboot的包。
1.解决方法1
勾选的应该包括下列几个包,pom.xml手动添加应该添加全面
在这里插入图片描述
2.解决方法2:重新勾选mybatis依赖(推荐)
添加如下插件
在这里插入图片描述
右键pom.xml
在这里插入图片描述

刚刚安装的插件
在这里插入图片描述

点击ok
在这里插入图片描述
勾选mybatis
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_46463341/article/details/125583091
今日推荐