GH-3114: Honor SpEL contract in ExpressionEvalMap

Fixes https://github.com/spring-projects/spring-integration/issues/3114

The contract of SpEL with its
`getValue(EvaluationContext context, @Nullable Object rootObject)` is
that we need to deal with provided `rootObject` even if it is `null`
and don't consult with `context.getRootObject()`

* Fix `ExpressionEvalMap` to have an internal `rootExplicitlySet`
to indicate that `root` explicitly provided by consumer, even if it is null.
According this flag call respective `Expression.getValue()`
* Add `@Nullable` to methods and their arguments into `ExpressionEvalMap`
& `FunctionExpression` to honor `Expression` contracts
* Populate an `HttpEntity` explicitly into `ExpressionEvalMap` from the
`HttpRequestHandlingEndpointSupport` and `WebFluxInboundEndpoint` for
full picture

* Fix JavaDocs indentations in the `ExpressionEvalMap`
This commit is contained in:
Artem Bilan
2019-11-22 16:29:23 -05:00
committed by Gary Russell
parent ee7be04c15
commit 516ecbcf8b
5 changed files with 76 additions and 35 deletions

View File

@@ -276,6 +276,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
headers.putAll(
ExpressionEvalMap.from(getHeaderExpressions())
.usingEvaluationContext(evaluationContext)
.withRoot(httpEntity)
.build());
}