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