스프링 캐싱 작업을 시작했습니다. 내 서비스 방법은스프링 캐싱 키 생성기
... 키 절없이
@Override
@Cacheable(value="profile", **key**="personId")
public String cpuService2(Long personId, String personAddress){
return "CachedMessage";
}
는 예외를 던져 나는이 메서드를 호출 할 때 같은 예외가 발생, 캐싱 등 뿐만 키를 자동 생성하는 두 매개 변수를 가정하지 않습니다 ..
Exception in thread "main" org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'personId' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:246)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:107)
at org.springframework.expression.spel.ast.OpGT.getValueInternal(OpGT.java:37)
at org.springframework.expression.spel.ast.OpGT.getValueInternal(OpGT.java:29)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:98)
at org.springframework.cache.interceptor.ExpressionEvaluator.condition(ExpressionEvaluator.java:99)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.isConditionPassing(CacheAspectSupport.java:462)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.isConditionPassing(CacheAspectSupport.java:456)
at org.springframework.cache.interceptor.CacheAspectSupport.inspectCacheables(CacheAspectSupport.java:292)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:199)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy5.cpuService3(Unknown Source)
at pack100_cache.pack020CacheKey.TestSimpleBean.main(TestSimpleBean.java:34)
검색된 문서이지만 실마리가 없습니다. 희망이 누군가를이 문제를 해결합니다.
감사 :
그런 다음 당신은 당신이 그것을 필요로 할이의 KeyGenerator에 연결할 수 있습니다. 잘못된 코드가있는 블로그를 언급하고있었습니다. – user3561481