org.springframework.beans.factory.UnsatisfiedDependencyException:个人解决办法
跟着视频学习mybatisPlus时候
执行测试代码,出现报错
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'com.tang.mybaitsplus.MyBatisPlusServiceTest': Unsatisfied dependency expressed through field 'userService';
nested exception is org.springframework.beans.factory.
NoSuchBeanDefinitionException: No qualifying bean of type 'com.tang.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因是.创建com.tang.service.UserService实例时,没有找到userService对象,实际就是没有扫描包
在MybaitsplusApplication文件中添加service包扫描代码