【发布时间】:2014-02-24 18:29:15
【问题描述】:
我的单元测试遇到问题。我目前使用 ehcache 和 spring 3.2 (@Cacheable) 一切正常,但我想在单元测试期间禁用缓存。
所以我在 src/test/resources/ehcache.xml 中写道:
<cache name="myCache"
maxElementsInMemory="1"
eternal="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="true"
maxElementsOnDisk="0"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="0"
memoryStoreEvictionPolicy="LRU"/>
但缓存仍在工作!有人有想法吗?
提前感谢您的帮助!
【问题讨论】:
-
您可以尝试从二级缓存中逐出作为一种选择。 (就在运行单元测试之前。)
标签: hibernate testng ehcache spring-data-jpa