1
votes

I am using ehcache-spring-annotations to cache my application data. For this, I have below configuration:

<bean id="ehCacheManager"
      class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" > 
      <property name="configLocation" value="classpath:ehcache.xml"/>
     </bean>      
    <ehcache:annotation-driven cache-manager="ehCacheManager" />  

I want to get the reference of 'net.sf.ehcache.CacheManager' out of configured bean 'ehCacheManager'. So that, I can manually perform put or remove operations directly in cache using 'CacheManager'.

Any way to get reference of 'net.sf.ehcache.CacheManager' out of 'org.springframework.cache.ehcache.EhCacheManagerFactoryBean'?

1

1 Answers

2
votes

I used below code to get the cache manager reference in my class:

@Resource
private CacheManager ehCacheManager;