带有Ehcache插件的Grails 3

时间:2017-02-27 11:14:00

标签: grails ehcache

我们正在尝试使用Grails 3的EHCache插件。

在build.gradle文件中,我们插入了以下配置:

compile "org.grails.plugins:cache"
compile("org.grails.plugins:cache-ehcache:1.0.5") {
    exclude module: "cache"
}

当对服务使用@Cachable注释时,内容由Core Plugin的默认缓存管理缓存,并且不由EHCache缓存。这会导致无休止的缓存,直到重新启动应用程序。

似乎grailsCacheManager未设置为GrailsEhcacheCacheManager类。 有人成功配置了带有grails 3的EHCache插件并可以提供配置吗?

1 个答案:

答案 0 :(得分:1)

我发现了问题:对于grails 3,必须将SNAPSHOT版本用于grails缓存插件。

此处提供更多信息: https://github.com/grails-plugins/grails-cache-ehcache/issues/26

我在EH Cache插件的build.gradle中的配置现在看起来像:

compile ("org.grails.plugins:cache-ehcache:3.0.0.BUILD-SNAPSHOT") {
    exclude group:'net.sf.ehcache'
}
// we have to downgrade the ehcache version. Otherwise it will not work together with hibernate ehcache
compile "net.sf.ehcache:ehcache:2.4.3"