When creating a clustered Cache following the Ehcache documentation, I get a PersistentCacheManager implementing org.ehcache.CacheManager but not javax.cache.CacheManager which is what I need in my Spring 6 application.
On Ehcache JSR107-Documentation I see no explicit hint regarding clustering.
How do I get a javax.cache.CacheManager supporting clustering Capabilities?
This is the example code for configuring clustered cacheManagers linked above:
CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder =
CacheManagerBuilder.newCacheManagerBuilder()
.with(ClusteringServiceConfigurationBuilder.cluster(URI.create("terracotta://localhost/my-application"))
.autoCreateOnReconnect(c -> c));
PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(true);
Yes it is not explicitly mentioned how to configure a clustered JCache CacheManager on JSR107 documentation, but you can find how to integrate Ehcache-Configuration with JCache Configuration there.
This is my working solution: