0

Trying to Autowire CacheManager and it throws Null Pointer. Essentially, like to use Spring's cache manager while actual implementation is by ehcache. The idea is to swap the actual cache provider in future that way writing to spring's interface. So, here is the configuration.

<bean id="cacheMgr" class="org.springframework.cache.ehcache.EhCacheCacheManager">
 <property name="cacheManager">
    <bean class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation" value="ehcache.xml"/>
        <property name="shared" value="true"/>
    </bean>
 </property>
</bean>

In the service class, trying to inject.

@Autowired
@Qualifier("cacheMgr")
private org.springframework.cache.CacheManager cacheMgr;

The problem is that "cacheMgr" is getting null. Not sure where the issue is.

0 Answers0