创建的Ehcache缓存中读取的Javadoc EhCacheManagerFactoryBean和EhCacheFactoryBean我想通:问题从春天
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:configLocation="classpath:ehcache.xml"/>
<bean id="locationCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"
p:cacheManager-ref="cacheManager"
p:cacheName="locationCache"/>
将创建一个高速缓存,我则可以在@Autowired但我必须失去了一些东西,因为这是我得到:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationCache' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.Cache.(Ljava/lang/String;ILnet/sf/ehcache/store/MemoryStoreEvictionPolicy; ZLjava/lang/String;ZJJZJLnet/sf/ehcache/event/RegisteredEventListeners; Lnet/sf/ehcache/bootstrap/BootstrapCacheLoader;II)V
我试过ehcache 1.7.2,1.6.2和1.5.0。
如果我指定在ehcache.xml中<cache name="locationCache" />
但我更喜欢它的工作原理已经我的配置在applicationsContext.xml
<cache name="locationCache" />
哪个版本的spring? – skaffman 2010-01-14 08:11:31
这是3.0.0.RELEASE – 2010-01-14 10:22:53
你需要3.1来使用hecache! – 2012-06-08 21:38:41