1
我在我的配置中具有下面的标题richher。弹簧集成标题Enricher空检查
<int:header-enricher input-channel="" output-channel="" id="" >
<int:header name="OrderNo" expression="@gateway.exchange(#root).payload"/>
</int:header-enricher>
当有效载荷为空,我得到异常
java.lang.IllegalArgumentException: payload must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.integration.support.MessageBuilder.<init>(MessageBuilder.java:56) ~[spring-integration-core-4.0.5.RELEASE.jar:na]
有没有办法从网关检查null有效载荷,并设置在头一些虚拟的价值,如果有效载荷为空?
<int:gateway id="gateway" default-request-channel="defReqChannel" />
<int-jdbc:stored-proc-outbound-gateway request-channel="defReqChannel" data-source="dataSourceDD" expect-single-result="true" is-function="false" stored-procedure-name="SP_GET_CODE">
<int-jdbc:sql-parameter-definition name="param1" direction="IN" />
<int-jdbc:sql-parameter-definition name="param2" direction="IN" />
<int-jdbc:sql-parameter-definition name="param3" direction="INOUT" />
<int-jdbc:sql-parameter-definition name="param4" direction="IN" />
<int-jdbc:parameter name="param1" expression="exp1" />
<int-jdbc:parameter name="param2" expression="exp2" />
<int-jdbc:parameter name="param3" value="0"/>
<int-jdbc:parameter name="param4" value="0"/>
</int-jdbc:stored-proc-outbound-gateway>
我正在调用的存储过程可以返回空值。 (参数3)。在这些情况下发生故障
我更新了原始代码片段 –
请在我的回答中找到UPDATE –