ARTICLE AD BOX
I have a question about Infinispan when its being used with Hibernate as a second level cache, while also being used as a regular cache with Spring.
Specifically, I have an Spring 7 application and I use Infinispan for caching. I have configured in spring my cache using GlobalConfigurationBuilder and creating a EmbededCacheManager bean. I have also configured Infinispan with Hibernate by setting hibernate.cache.use_second_level_cache to true and hibernate.cache.region.factory_class to InfinispanRegionFactory.class.getName().
I have noticed though that Infinispan does not use my EmbededCacheManager in Hibernate but creates a new one.
Is this practice acceptable or should I use a shared cache manager for both Spring and Hibernate?
If using a shared cache manager is the better choice, can you provide an example to to achieve this because I can't find any recent resources online.
Versions:
Java 21
Spring Framework 7 (not Spring Boot)
Hibernate 7.2
Infinispan 16.1
