当前位置: 代码迷 >> Web前端 >> spring测试加载web-inf上的配置文件
  详细解决方案

spring测试加载web-inf上的配置文件

热度:203   发布时间:2012-10-13 11:38:17.0
spring测试加载web-inf下的配置文件

AbstractTransactionalDataSourceSpringContextTests使用spring集成测试时候可以通过以下方式载入WEB-INF下的配置文件:
Java代码
protected String[] getConfigLocations() {      
        return new String[] {       
                "file:WebRoot/WEB-INF/applicationContext.xml"};      
    }  

protected String[] getConfigLocations() {   
        return new String[] {    
                "file:WebRoot/WEB-INF/applicationContext.xml"};   
    }



其中file:表示相对于项目根目录
  相关解决方案