All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.javax.cache.spring.HibernateAwareJCacheManagerFactoryBean Maven / Gradle / Ivy

There is a newer version: 5.3.1
Show newest version
package nl.vpro.javax.cache.spring;

import javax.cache.Caching;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.springframework.cache.jcache.JCacheManagerFactoryBean;

public class HibernateAwareJCacheManagerFactoryBean  extends JCacheManagerFactoryBean {

     {
         // See, MSE-5473 This is what org.hibernate.cache.jcache.internal.JCacheRegionFactory ends up doing.
         super.setBeanClassLoader(Caching.getCachingProvider().getDefaultClassLoader());

     }
    @Override
    public void setBeanClassLoader(@NonNull ClassLoader classLoader) {
        // just disable this. Will otherwise be called by spring.
        // But it must remain the class loader that also hibernate, otherwise
        // we'll end up with to cache managers.
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy