【问题标题】:Implementing spring cache plugin in grails在grails中实现spring cache插件
【发布时间】:2012-04-18 01:29:42
【问题描述】:

我想在我的 grails 应用程序中实现 spring 缓存插件,并且我已经使用 install-plugin 命令安装了该插件。

根据我 resources.groovy 中 spring 缓存的 documentation 我有缓存配置

venueCache(org.springframework.cache.ehcache.EhCacheFactoryBean) { bean ->
    cacheManager = ref("springcacheCacheManager")
    eternal = true
    diskPersistent = false
    cacheName = "venueCache"
}

在控制器中,我的表演动作中有@Cacheable("venueCache")

@Cacheable("venueCache")
def show(id) {
 ...
}

但每当我启动应用程序并多次点击 URL 时,它似乎并没有从缓存中提供。它记录了语句:

web.GrailsFragmentCachingFilter - No cacheable annotation found for GET:/grails/venue/action-router.dispatch grails.plugin.springcache.web.FilterContext@4f7351e4

我的配置中是否缺少任何东西

【问题讨论】:

    标签: spring caching grails


    【解决方案1】:

    这对我来说有些愚蠢 - 我必须为 @Cacheable 注释导入 grails.plugin.springcache.annotations.* ,但 STS 自动导入了 Spring Cacheable 注释。将导入更改为 grails.plugin.springcache.annotations.* 并且一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-28
      • 2016-05-24
      • 1970-01-01
      • 2012-04-13
      • 1970-01-01
      • 2012-02-19
      • 1970-01-01
      • 2011-08-15
      相关资源
      最近更新 更多