SpringBoot做单元测试爆空指针NullPointerException

debug测试类发现异常出现在service调用接口方法上,其他地方没有问题,最后发现是因为测试类上没有加上SpringBoot专有的测试注解:

@SpringBootTest
@RunWith(SpringRunner.class)

加上就没问题了。

相关文章:

  • 2022-12-23
  • 2022-01-13
  • 2021-05-24
  • 2022-12-23
  • 2021-08-14
  • 2021-06-30
猜你喜欢
  • 2021-09-30
  • 2021-07-18
  • 2021-08-31
  • 2021-04-07
  • 2021-07-15
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案