在我的应用程序中,我想通过使用启用二级缓存Hibernate 5.4
,EHCache 3.7
但我收到此错误
java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider org.ehcache.jsr107.EhcacheCachingProvider could not be instantiated
java.lang.IncompatibleClassChangeError: Implementing class
我正在使用的依赖项:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jcache</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.7.1</version>
</dependency>
以及二级缓存的配置:
properties.setProperty(Environment.USE_QUERY_CACHE, "true");
properties.setProperty(Environment.CACHE_REGION_FACTORY, "jcache");