I’m using Spring 3.1 and I want to use the new cache features. Then, I tried:
<cache:annotation-driven />
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
p:cache-manager-ref="ehcache" />
<!-- Ehcache library setup -->
<bean id="ehcache"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:config-location="classpath:ehcache.xml" />
But I didn’t find the way to configure my custom KeyGenerator. Any idea?
Ok, I just find a way to do this…
As you can see, I use the AnnotationDrivenCacheBeanDefinitionParser, I put the configuration in my xml, and it works 🙂 Done!
edit:
For Spring > 3.2, you can use a simple Java class configuration implementing CachingConfigurer: