dplesa
dplesa

Reputation: 1415

Spring and WildFly Infinispan cache lookup

I have implemented caching in my Spring application and when I run it locally everything works fine. I have infinispan.xml configuration in resources and the following configuration:

spring.cache.type=infinispan
spring.cache.infinispan.config=classpath:infinispan.xml

Now I would like to deploy it to WildFly 10 and to use built in cache. I have defined my cache container with jndi-name=infinispan/CONTAINER.

I tried setting spring.cache.infinispan.config to:

infinispan/CONTAINER
java:/infinispan/CONTAINER
java:jboss/infinispan/CONTAINER

But I allways get the following error:

java.lang.IllegalArgumentException: Cache configuration does not exist 

What should I do make this work?

Upvotes: 3

Views: 845

Answers (1)

Sebastian Łaskawiec
Sebastian Łaskawiec

Reputation: 2737

As far as I know, this is not possible at the moment.

You will need to extend SpringEmbeddedCacheManagerFactoryBean and override #createBackingEmbeddedCacheManager() method. Then use JndiTemplate to grab a reference to EmbeddedCacheManager deployed in WildFly (similarly to this thread).

I also created ISPN-7208 to allow specifying JNDI references for Cache Managers.

Upvotes: 1

Related Questions