有没有一种使用注释配置EHcache的方法。
我有一个启用了缓存的Spring/Hibernate项目。目前我正在使用ehcache.xml定义如何缓存实体的配置。
这是我的ehcache.xml文件的样子:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true"
monitoring="autodetect"
dynamicConfig="true">
<diskStore path="java.io.tmpdir/ehcache"/>
<defaultCache
.
.
.
</defaultCache>
<cache name="exmaple.model.User" maxEntriesLocalHeap="1000" eternal="false"
timeToIdleSeconds="120" timeToLiveSeconds="300">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>
我想知道是否可以在@Entity的顶部使用注解来实现相同的效果,而不是使用这个xml文件。