2 Replies Latest reply on Jun 20, 2012 2:19 AM by Robin Wyss

    Unable to cache successfully using infinispan and Spring cache abstraction

    venkataratnam teki Newbie

      I am trying to do a simple example with spring cache abstraction and infinispan as the cache provider.

      This is the snippet from my springconfig.xml

      <bean id="cacheManager"         class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean">

      <property name="configurationFileLocation" value="classpath:infinispan-config.xml"></property>


      This is the code from my infinispan-config.xml

      <global/> <default> <jmxStatistics enabled="true"/> </default> <namedCache name="books"> </namedCache> 

      Here is my BookDaoImpl code

      @Cacheable(value="books", key="bookId")

      Book findBook(Integer bookId) {

      Here is my main method code

      BookDaoImpl b = (BookDaoImpl) ctx.getBean("bookDao");

      Book b1 = b.findBook(3);


      Book b2 = b.findBook(3);

      I am seeing findBook method is executed both the times which is not expected.

      Can somebody help me out, what went wrong.!

      Thanks, -Venkat