我的错误如下:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.cy.store.service.UserServiceTests’: ***Unsatisfied dependency expressed through field 'userService ***’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.cy.store.service.IUserService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
org.springframework.beans.factory.NoSuchBeanDefinitionException没有找到这个bean的
出现这个错的原因是我没有在我的UserServiceImpI上加注解@Service
(@Service注解:将当前类的对象交给Spring来管理,自动创建对象以及对象的维护)