我们计划使用Spring 3.1缓存抽象而不是Grails Spring缓存插件。我已经在本地进行了实验,但是在使用Spring el表达式(例如

@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上运行)

最佳答案

您应该尝试使用“#sessionStorageService.getUser()”

10-08 18:46