【发布时间】:2012-04-08 10:39:33
【问题描述】:
我想在 ehcache.xml 文件(如 ${})中放置属性占位符,以便可以在运行时从外部属性文件 (.properties) 替换值。 比如:
ehcache.xml(在类路径中):
<defaultCache maxElementsInMemory="20000" eternal="false" timeToIdleSeconds="${default_TTI}" timeToLiveSeconds="86400" overflowToDisk="true" ... />
ehcache.properties(在战争/类路径之外):
... default_TTI=21600 ...
目的是能够更改缓存配置而无需重新构建应用程序。 Spring 的 PropertyPlaceHolder 仅适用于我不想要的 ehcache 的 Spring bean 定义(需要将 ehcache.xml 保留为文件)
这里有类似的帖子,但没有让我找到解决方案。我已经找了一个星期了!!
我正在使用 Spring 2.5.6、Hibernate 3.2.6 和 Ehcache 2.4.6
任何帮助或想法都非常感谢!
非常感谢, Tripti。
【问题讨论】:
标签: java spring hibernate ehcache second-level-cache