FunctionExpression
我们导入了 FunctionExpression
类(SpEL 的 Expression
接口的实现)以使用 lambda 和 泛型
。当有来自 Core Spring 集成的隐式 Strategy
变体时,为 DSL 组件提供 Function<T, R>
选项以及 expression
选项。以下示例演示了如何使用函数表达式:
We introduced the FunctionExpression
class (an implementation of SpEL’s Expression
interface) to let us use lambdas and generics
.
The Function<T, R>
option is provided for the DSL components, along with an expression
option, when there is the implicit Strategy
variant from Core Spring Integration.
The following example shows how to use a function expression:
.enrich(e -> e.requestChannel("enrichChannel")
.requestPayload(Message::getPayload)
.propertyFunction("date", m -> new Date()))
FunctionExpression
也支持运行时类型转换,如同在 SpelExpression
中所做。
The FunctionExpression
also supports runtime type conversion, as is done in SpelExpression
.