繁体   English   中英

如何处理使用正则表达式给出的 xml 文件路径以支持 Spring 集成测试的多个环境?

[英]How to handle xml file path given using regular expression to support multiple environment for Integration Testing by Spring?

我的 test-appContext.xml 文件中有以下配置,用于支持执行 spring 集成测试。

<bean id="cacheManagerConfig" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> 
    <property name="configLocation" value="file:/web/${websphere.env}/${websphere.Domain}/${websphere.Name}/myportal/config/ehcache.xml"/>
</bean>

我正在使用 junit 4.12 和 spring 4 进行 MVC 流的集成测试。
spring集成测试中如何处理ehcache.xml文件路径。

谢谢 :)

我得到了解决方案,作为从系统属性检索值的表达式,在 Liberty 服务器的情况下,jvm.options 文件所以我在测试用例类中使用了以下代码。

static {
        System.setProperty("websphere.env", "test");
        System.setProperty("websphere.Domain", "mytestdomain");
        System.setProperty("websphere.Name", "mytestdomain");

    }

它的工作正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM