2012-04-10 191 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