读书人

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

发布时间: 2012-10-13 11:38:17 作者: rapoo

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:表示相对于项目根目录

读书人网 >Web前端

热点推荐