[英]Junit Spring initialization is not working
When I run the below test, It just hangs. 当我运行以下测试时,它挂了。 I took a thread dump and fount out that its blocking in SpringJunit4ClassRunner line 91 where there is this line
我进行了一个线程转储,并发现它在SpringJunit4ClassRunner第91行中的阻塞处存在该行
private static final Log logger =
LogFactory.getLog(SpringJUnit4ClassRunner.class);
=========My Test Program ==============================
@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations={"/context-test.xml"})
public class ClassTest{
// @Autowired
// ClassName bean;
@Test
public void testConfig() {
System.out.println("hello");
// System.out.println(bean.getConnectTimeout());
System.out.println("end");
}
}
Is anyone facing the same problem and how did you fix this? 是否有人面临相同的问题,您如何解决此问题?
Found out that JMockito was sharing the commons-logging library which the spring-context uses and jMockito was not initializing it which in turn caused this program to hang. 发现JMockito共享了spring上下文使用的commons-logging库,而jMockito没有初始化它,这反过来导致该程序挂起。
Removing the Jmockito dependency made it work. 删除Jmockito依赖关系使其起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.