1

grails アプリにスプリング キャッシュ プラグインを実装したいのですが、install-plugin コマンドを使用してプラグインをインストールしました。

私のresources.groovyのスプリングキャッシュのドキュメントに従って、私はキャッシュ構成を持っています

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

構成に欠けているものはありますか

4

1 に答える 1

2

@Cacheable アノテーション用に grails.plugin.springcache.annotations.* をインポートする必要がありましたが、代わりに STS が Spring Cacheable アノテーションを自動インポートしました。インポートを grails.plugin.springcache.annotations.* に変更し、すべて正常に動作しました

于 2012-04-17T17:29:42.510 に答える