1

我的 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>

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

谢谢 :)

4

1 回答 1

1

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

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

    }

它工作正常。

于 2020-02-24T13:43:49.857 回答