Skip to content

Document that functions are variables in SpEL EvaluationContexts #32258

Closed
@sbrannen

Description

Although EvaluationContext defines the API for setting and looking up variables, the internals of the Spring Expression Language (SpEL) actually provide explicit support for registering functions as variables.

This is evident in the two registerFunction() variants in StandardEvaluationContext; however, functions can also be registered as variables when using the SimpleEvaluationContext.

Since custom functions are also viable in use cases involving the SimpleEvaluationContext, we should document that functions may be registered in a SimpleEvaluationContext via setVariable().

We should also explicitly document the "function as a variable" behavior in the class-level Javadoc for both StandardEvaluationContext and SimpleEvaluationContext.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: documentationA documentation task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions