我遇到以下问题。
我的项目中有一套测试服,每个单独的测试都运行良好。
但是,当我将它们作为套件运行时,其中一些会失败,但出现以下异常:
Caused by: java.lang.IllegalStateException: The dao Cache is not alive (STATUS_SHUTDOWN)
at net.sf.ehcache.Cache$CacheStatus.checkAlive(Cache.java:4269)
at net.sf.ehcache.Cache.checkStatus(Cache.java:2703)
at net.sf.ehcache.Cache.get(Cache.java:1576)
at org.springframework.cache.ehcache.EhCacheCache.get(EhCacheCache.java:61)
at org.springframework.cache.interceptor.CacheAspectSupport.inspectCacheables(CacheAspectSupport.java:310)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:198)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
有没有办法避免这种行为,即在多个测试中保持缓存活动或正确关闭它?