起因:
之前的正常运行的springboot项目,添加了新的jar包和新的java文件,结果就出现了这个问题
报错详情:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openController': Unsatisfied dependency expressed through field 'clientService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clientService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.huban.app.dao.ClientDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因:
Autowired 找不到 DAO 注入的对象
我的解决办法
1、查看报错的路径ClientDao路径是否正确、配置的扫描dao包路径是否正确(我的是扫描路径错误)
2、查看mybatis plus配置的 扫描实体类路径是否正确
3、去到mybatis plus的mapper.xml 文件夹下面查看对应Dao的xml文件是否配置错误(我的是下xml配置错误,之前的xml忘了删除导致的)