ehcache.xml无法使用属性文件属性

时间:2014-01-17 16:31:30

标签: java xml spring ehcache

我在类路径中定义了一个system.properties,然后我在spring配置xml中这样做:

<context:property-placeholder location="classpath*:/system.properties" ignore-resource-not-found="true" ignore-unresolvable="true" />

我也是这样定义ehcache:

<cache:annotation-driven cache-manager="cacheManager" />

    <bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation" value="classpath:/ehcache.xml" />
        <property name="shared" value="true" />
    </bean>

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager" ref="ehCacheManager" />
    </bean>

我在system.properties文件中定义了一个属性:

system.project_name=myproject
像这样的ehcache.xml:

<diskStore path="e:/${system.project_name}/cache" />

我想使用system.project_name属性来存储缓存,但是当我部署项目时,我发现目录是:

enter image description here

即使我在Spring配置xml文件中定义了一个PropertyPlaceholderConfigurer,我也说不能使用这些属性?

0 个答案:

没有答案
相关问题