【发布时间】:2018-11-01 05:34:09
【问题描述】:
我在 Spring Boot 中使用 TestNg 来测试用例。 我的测试用例中的一个对象具有 BeanFactory Bean 的依赖关系。
@Test
void testMe(){
Obj obj = new Obj();
}
上面是测试用例,下面是Obj类
class Obj{
@Autowired
BeanFactory beanFactory;
//rest of the code
}
当我在上面运行测试用例时,它给了我空指针异常,任何人都知道如何解决这个问题。
【问题讨论】:
标签: java spring spring-boot testng spring-test