Springboot整合Mybatis报错
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
问题描述
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'com.xsk.springboot_08mybatis.Springboot08mybatisApplicationTests':
Unsatisfied dependency expressed through field 'bookDao';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com.xsk.dao.BookDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因分析:
boot。application文件与dao不同级
解决方案:
将application文件拖出来,与dao同级,这样就可以找到bean。