由于我注入的service里面加载了一些properties等文件,导致出现路径问题使得applicationContext.xml加载不成功。
类似:
假如我要初始化一个abcService,这个service加载了/web-inf/abc.properties
由于正常运行时,初始化abcService需要读取
d:\eclipse.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\testPrj\WEB-INF\abc.properties
但做junit测试的时候,我看当前的运行目录变成了
d:\eclipse\testPrj\build了
这样无论我想怎么弄都找不到那个abc.properties了,于是初始化abcService就出错,applicationContext.xml加载不成功
我想这应该是个常见的问题,可惜我找不到答案,也不知道怎么搜索
各位有没有什么解决办法?多谢了!