Announcement Announcement Module
Collapse
No announcement yet.
Facing issue with ehcache while configuring in spring context. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Facing issue with ehcache while configuring in spring context.

    Hi,
    I am using Spring 3.0.6 in my project in which i am trying to configure the annotation based ehcache. Below are the beans i have defined for cacheManager and cache in my spring context. When i test this configuration i am not getting the cache under the cacheManger. The requirement is to provide the cache initializing parameters through a property file thats why i am not using external ehcache.xml for cache configuration. I am not sure if i am missing any particular configuration to make it working, as per the API it should add the cache to the cacheManager but while debugging i didn't find any cache in the cacheManager. Please suggest. Many thanks in advance!
    Code:
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" name="cacheManager">
        <property name="configLocation"  value="test-wpsEhcache.xml"/>
    </bean>
    Code:
    <bean id="dictionaryItemCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
        <property name="cacheManager"  ref="cacheManager"/>
        <property name="cacheName"  value="dictionaryItemCache"/>
        <property name="maxElementsInMemory" value="${ehcache.dictionaryItem.maxElementsInMemory}" />
        <property name="timeToLive" value="${ehcache.dictionaryItem.timeToLiveSeconds}" />
        <property name="overflowToDisk" value="false" />
        <property name="diskPersistent" value="false" />
        <property name="memoryStoreEvictionPolicy" value="LRU" />
    </bean>
    maven dependecy inserted in pom

    Code:
    <dependency>
        <groupId>com.googlecode.ehcache-spring-annotations</groupId>
        <artifactId>ehcache-spring-annotations</artifactId>
        <version>1.2.0</version>
    </dependency>
Working...
X