Spring-mock测试加载XML问题。
用Spring-mock测试Spring时,测试类继承了AbstractDependencyInjectionSpringContextTests,实现方法加载xml文件:
protected String[] getConfigLocations()
{
String[] configLocations = {
"applicationContext_bsn.xml",
"applicationContext_consumer.xml",
"applicationContext_Dao.xml",
"applicationContext_datasource.xml",
"applicationContext_Ibatis.xml",
"applicationContext_timer.xml",
"applicationContext.xml"};
return configLocations;
}
这样写是xml文件在classpath下,如果我把xml文件换个地方放,不在classpath下面请问该如何加载呢?
上面我写成绝对路径也试过,不行,说是找不到该路径下的xml文件。
而"file:/src/application/abc.xml"这种写法我们不允许,
请问如何写能让它读绝对路径。