我试图创建一个使用Spring TestContext框架加载applicationContext.xml的测试,代码很简单:了Spring TestContext框架
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml"})
public class ApplicationContextLoadingTest {
@Autowired
private ApplicationContext applicationContext;
@Ignore
@Test
public void testContext() {
}
}
当我运行测试我得到了错误信息:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pollInitializer' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) ...
任何人都知道这意味着什么?由于
我自动连线ApplicationContext的原因是我想测试该文件可以成功加载。 – ohana 2011-03-31 20:27:16