小编Den*_*s S的帖子

Spring context属性 - placholder ehcahe配置

我有一个spring context xml文件

<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>
Run Code Online (Sandbox Code Playgroud)

目标是允许客户编辑属性文件,如下所示

cache.maxMemoryElements="2000"
Run Code Online (Sandbox Code Playgroud)

然后在实际的cacheConfig.xml文件中有这个

<cache name="someCacheName"
   maxElementsInMemory="${cache.maxMemoryElements}" ... />
Run Code Online (Sandbox Code Playgroud)

这样我们不希望客户改变的项目不会暴露.当然,上述细节仅部分详细,不起作用.目前我在日志文件中看到了这一点

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".
Run Code Online (Sandbox Code Playgroud)

提前致谢...

java spring ehcache

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

ehcache ×1

java ×1

spring ×1