Spring Cache Abstraction

Failed to convert property value of type ‘java.lang.String’ to required type ‘net.sf.ehcache.CacheManager’ for property ‘cacheManager’

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager="ehcache"/>
<!-- Ehcache library setup -->
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="classpath:com/spring/test/ehcache/config/ehcache.xml"/>

解决方法:

p:cache-manager不适用于bean引用.试试这个:

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
   <property name="cacheManager" ref="ehcache"/>
</bean>

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
   <property name="configLocation" value="classpath:com/spring/test/ehcache/config/ehcache.xml"/>
</bean>
上一篇:java – 如何正确使用getHibernateTemplate().setCacheQueries()?


下一篇:Ehcache缓存数据