org.springframework.expression.spel.SpelEvaluationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The {{condition}} attribute does not allow to use bean references. Assuming the following setup and a {{securityChecker}} bean with the requested method {code:java} @Cacheable(cacheNames = "myCache", condition = "@securityChecker.isSecured()") {code} We get {noformat} org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'securityChecker' at org.springframework.expression.spel.ast.BeanReference.getValueInternal(BeanReference.java:48) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.ExpressionEvaluator.condition(ExpressionEvaluator.java:119) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.isConditionPassing(CacheAspectSupport.java:607) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.isConditionPassing(CacheAspectSupport.java:481) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:433) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] {noformat}
    via by Stéphane Nicoll,
  • The {{condition}} attribute does not allow to use bean references. Assuming the following setup and a {{securityChecker}} bean with the requested method {code:java} @Cacheable(cacheNames = "myCache", condition = "@securityChecker.isSecured()") {code} We get {noformat} org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'securityChecker' at org.springframework.expression.spel.ast.BeanReference.getValueInternal(BeanReference.java:48) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299) ~[spring-expression-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.ExpressionEvaluator.condition(ExpressionEvaluator.java:119) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.isConditionPassing(CacheAspectSupport.java:607) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.isConditionPassing(CacheAspectSupport.java:481) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:433) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] {noformat}
    via by Stéphane Nicoll,
    • org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'bean_1216598906' at org.springframework.expression.spel.ast.BeanReference.getValueInternal(BeanReference.java:45)

    Users with the same issue

    serious2monkeysserious2monkeys
    2 times, last one,