问答详情
源自:2-7 单元测试

单元测试无法注入对象

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.example.springboot.service.GirlServiceTest': Unsatisfied dependency expressed through field 'girlService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.springboot.service.GirlService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


提问者:拾千 2017-12-08 19:21

个回答

  • qq_临界_0
    2019-04-24 15:11:10

    老铁,解决了没有呀?

  • tangxs
    2017-12-09 15:43:34

    可能是GirlService类或者实现类,没加@Service注解