I am facing SpelEvaluationException in executing below method.
@Override
@Cacheable(cacheNames = "permissionsCache", key = "#jwt.tokenValue")
public List<String> getPermissions(Jwt jwt) {
if (skippedPermissionResolutionPathsProvider.skipPaths().contains(request.getRequestURI())) {
return Collections.emptyList();
}
return requestForList(jwt, "/current/entitlements");
}
org.springframework.expression.spel.SpelEvaluationException Create breakpoint: EL1007E: Property or field ‘tokenValue’ cannot be found on null
org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224)
at
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:111)
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:416)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:98)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:114)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:273)
at org.springframework.cache.interceptor.CacheOperationExpressionEvaluator.key(CacheOperationExpressionEvaluator.java:106)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.generateKey(CacheAspectSupport.java:913)
at org.springframework.cache.interceptor.CacheAspectSupport.generateKey(CacheAspectSupport.java:703)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedValue(CacheAspectSupport.java:480)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:431)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:395)
As per JavaDocs, SpEL considers parameters as a key unless a custom {@link #keyGenerator} has been configured. We have Jwt passed as parameter in method.
I have also verified that jwt object is initialized properly and is not null when this method is executed.
Did anyone faced something similar?