Java 如何向有效负载表达式添加两个PathVariable?
我有一个带有path和一个pathVariables的入站通道适配器,但现在我想添加第二个变量,但找不到它在有效负载中的外观 我找到了这个解决方案,但我不希望我的变量出现在标题中:Java 如何向有效负载表达式添加两个PathVariable?,java,spring-integration,Java,Spring Integration,我有一个带有path和一个pathVariables的入站通道适配器,但现在我想添加第二个变量,但找不到它在有效负载中的外观 我找到了这个解决方案,但我不希望我的变量出现在标题中: <int-http:inbound-gateway id="restCall" request-channel="jobRunner" supported-methods="POST"
<int-http:inbound-gateway id="restCall"
request-channel="jobRunner"
supported-methods="POST"
path="/etl/{jobName}/{currentCustomer}">
<int-http:header name="jobName" expression="#pathVariables.jobName"/>
<int-http:header name="currentCustomer"/>
</int-http:inbound-gateway>
我需要像这样的东西:
<int-http:inbound-gateway id="restCall"
request-channel="jobRunner"
supported-methods="POST"
path="/etl/{jobName}/{currentCustomer}"
payload-expression =
"#pathVariables.jobName,#pathVariables.currentCustomer">
</int-http:inbound-gateway>
有效载荷是单个物体;不可能是两个 您可以将其中一个变量添加到
中,或者创建一些POJO并使用
"new com.foo.MyVariableContainer(#pathVariables.jobName, #pathVariables.currentCustomer)"
您还可以使用SpEL:中的内联映射。这样,消息中的有效负载将作为标准的Map
。另一方面,请分享你的期望?该表达式的结果应该是什么(无效-抱歉)?