2012-04-10 34 views
2

我們計劃使用Spring 3.1緩存抽象而不是Grails Spring緩存插件。我已經在本地嘗試,但使用Spring EL表達式就像Grails - 在Spring 3.1中使用Spring el表達式@Cacheable

@Cacheable(value = 'dashboardCache', key = 'sessionStorageService.getUser()', condition = 'sessionStorageService.getUser() != null') 
public List<BusinessDashboard> getUserDashboards(String serverName, SessionStorageService sessionStorageService) { ... } 

執行集成測試情況

EL1008E:(pos 0): Field or property 'sessionStorageService' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject' 
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'sessionStorageService' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject' 

當出現以下錯誤時發生的問題,我認爲這種行爲是造成失蹤調試信息 - 因此我的問題:

在Grails應用程序中是否可以啓用Spring el表達式,或者在編譯過程中是否有任何參數來告訴Grails在類文件中保留調試符號?

(我們在Grails的2.0.1運行)

回答

4

你應該嘗試 '#sessionStorageService.getUser()'

+0

你說得對,我無法從文檔看到這一點。 – 2012-05-22 07:22:57