依赖注入问题。

    当时做项目是要去加载一个外部空间,一些固定变量存到配置文件

SpringBoot单元测试依赖注入失败

 

然后单元测试的时候,一直报报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sunnada.gaia.data.web.AutomaticSealTest': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.sunnada.gaia.data.web.controller.construction.AutomaticStampController' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

,注入失败,没有这个类型,懵逼了一晚上,后面发现是在这个类里我写了一个测试方法(@Test),就是这个问题,导致单元测试注入失败,

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2023-03-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-23
  • 2021-09-30
  • 2022-02-26
  • 2021-05-14
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案