Class StandardEvaluationContext

java.lang.Object
org.springframework.expression.spel.support.StandardEvaluationContext
All Implemented Interfaces:
EvaluationContext
Direct Known Subclasses:
MethodBasedEvaluationContext

public class StandardEvaluationContext extends Object implements EvaluationContext
A powerful and highly configurable EvaluationContext implementation.

This context uses standard implementations of all applicable strategies, based on reflection to resolve properties, methods, and fields. Note, however, that you may need to manually configure a StandardTypeLocator with a specific ClassLoader to ensure that the SpEL expression parser is able to reliably locate user types. See setTypeLocator(TypeLocator) for details.

In addition to support for setting and looking up variables as defined in the EvaluationContext API, StandardEvaluationContext also provides support for registering and looking up functions. The registerFunction(...) methods provide a convenient way to register a function as a Method or a MethodHandle; however, a function can also be registered via setVariable(String, Object) or setVariables(Map). Since functions share a namespace with the variables in this evaluation context, care must be taken to ensure that function names and variable names do not overlap.

For a simpler, builder-style context variant for data-binding purposes, consider using SimpleEvaluationContext instead which allows for opting into several SpEL features as needed by specific use cases.

Since:
3.0
Author:
Andy Clement, Juergen Hoeller, Sam Brannen, Stephane Nicoll
See Also: