SpelExpression.getValue() has thrown a SpelEvaluationException

org.springframework.expression.spel.SpelEvaluationException
Javadoc
Root exception for Spring EL related exceptions. Rather than holding a hard coded string indicating the problem, it records a message key and the inserts for the message. See {@link SpelMessage} for the list of all possible messages that can occur. @author Andy Clement @author Juergen Hoeller @since 3.0
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty
(source)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal
(source)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue
(source)
at org.springframework.expression.spel.standard.SpelExpression.getValue
(source)
3 frames hidden

Typical Exception Messages

  1. EL1008E:(pos 0): Field or property 'myKey' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
  2. EL1008E:(pos 0): Field or property 'stepExecutionContext' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'

Origin

SpelNodeImpl.getValue() has thrown a SpelEvaluationException

org.springframework.expression.spel.SpelEvaluationException
2 frames hidden
org.springframework.expression.spel.ast.SpelNodeImpl.getValue
3Web pages

Solution

rafael, 1 year ago

You can only access stepExecutionContext within a bean defined in the scope = "step", add "scope = "step"" to your bean declaration.

Check the source of this solution for more info

External results for this pattern (2)

  1. EL1008E:(pos 0): Field or property 'stepExecutionContext' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'
    Show stack trace
  2. blue-skyvia Stack Overflow2 years ago
    EL1008E:(pos 0): Field or property 'myKey' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'
    Show stack trace