我正在尝试使用缓存抽象文档中的方法访问自定义键生成器,以生成用于缓存的键,但到目前为止,我还没有找到我给出代码的任何solution...here
@Cacheable(value = "itemsCache", key ="T(com.ernst.transactionsAPI.IndexKeyGenerator).generate(#root.target, #root.method.name, #root.args[0])")
`public List<FilialenImpl> getOutletByCustomSearchCache(SearchParametersImpl searchParameters);`我得到了以下错误:
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 47): Method call: Method generate(com.ernst.transactionsImpl.filialen.FilialenServiceBean,java.lang.String,com.ernst.persistenceImpl.impl.SearchParametersImpl) cannot be found on com.ernst.transactionsAPI.IndexKeyGenerator type它不反映方法名,但它传递了方法type..can,请大家看看如何解决这个问题。
方法如下所示:
public Object generate(Object target, Method method, Object... params) {
...}提前谢谢你,
你好,Rajasekhar。
发布于 2013-01-30 22:41:35
我已经在IndexKeyGenerator类中编写了一个静态方法generateKey,并直接调用它,如下面的code..then中所示,单个缓存的自定义缓存非常完美
@Cacheable(value = "itemsCache", key ="T(com.ernst.transactionsAPI.IndexKeyGenerator).generateKey(#root.target, #root.method, #root.args[0])") public List<FilialenImpl> getOutletByCustomSearchCache(SearchParametersImpl searchParameters);
不要忘记覆盖SearchParameters类。
https://stackoverflow.com/questions/14462430
复制相似问题