<context:property-placeholder location="classpath:cacheConfig.properties"/>
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="cacheManagerName" value="cacheName"/>
<property name="shared" value="false"/>
<property name="configLocation" value="classpath:cacheConfig.xml"/>
</bean>
目标是允许客户像这样编辑属性文件
cache.maxMemoryElements="2000"
然后在实际的cacheConfig.xml文件中添加以下内容
<cache name="someCacheName"
maxElementsInMemory="${cache.maxMemoryElements}" ... />
为了避免客户更改我们不想要的项目,我们需要隐藏它们。当然,以上细节只是部分详细信息,目前在日志文件中看到:
Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Error configuring from input stream. Initial cause was null:149: Could not set attribute "maxElementsInMemory".
Thanks in advance...