【发布时间】:2016-07-05 01:17:56
【问题描述】:
我正在使用 Spring Caching 框架和 redis。以下是我使用的 Cacheable
@Cacheable(value = "oauth2token", key="#value + #type")
public OAuth2Token findOneByValueAndType(String value, String type);
我只是想创建一个我知道的密钥。这给出了错误
14:20:21,199 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/veip-web].[Resteasy]] (http-/0.0.0.0:8080-63) JBWEB000236: Servlet.service() for servlet Resteasy threw exception: org.springframework.expression.spel.SpelEvaluationException: EL1030E:(pos 0): The operator 'ADD' is not supported between objects of type 'null' and 'null'
因为当我没有将键指定为流时。
@Cacheable(value = "oauth2token")
public OAuth2Token findOneByValueAndType(String value, String type);
我可以看到生成了一个疯狂的密钥。我需要知道密钥,因为稍后我需要CachePut 并更新相同的项目。
我也尝试过关注。
@Cacheable(value = "oauth2token", key="#type.contact(#value)")
public OAuth2Token findOneByValueAndType(String value, String type);
Spring 抱怨当时#type 为空。
这里有什么问题。
【问题讨论】:
-
错的是你通过
null.
标签: spring-mvc spring-el spring-cache