gpt4 book ai didi

java - 如何使用 request-handler-advice-chain 和 ExpressionEvaluatingRequestHandlerAdvice?

转载 作者:行者123 更新时间:2023-12-02 02:46:40 26 4
gpt4 key购买 nike

它是 xml.ftl:

<integration:channel id="${provider_name}Channel"/>
<integration:header-enricher input-channel="${provider_name}Channel"
output-channel="${provider_name}reformedNumberChannel">
<integration:header name="reformedNumber"
expression="T(com.tosan.chapar.core.helper.PhoneNumberHelper).removeInitialPlus(headers[recipient])"/>
<integration:header name="body" expression="payload"/>
</integration:header-enricher>

<jdbc:outbound-gateway request-channel="${provider_name}reformedNumberChannel"
data-source="${provider_name}DataSource"
update="insert into `outgoing_message` (`from_mobile_number`, `dest_mobile_number`, `message_body`, `due_date`, `creation_date`, `udh`, `source_port`, `dest_port`, `dcs`, `priority`, `status`)
values ('${sms_number}', :headers[reformedNumber], :payload, now(), now(), '', :headers[port], :headers[port], :headers[dcs], :headers[priority], null);"
reply-channel="${provider_name}OutputChannel">
<jdbc:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="trapException" value="true"/>
<property name="onFailureExpression" value="payload"/>
<property name="failureChannel" value="failures"/>
</bean>

</jdbc:request-handler-advice-chain>
</jdbc:outbound-gateway>

<integration:transformer input-channel="failures" output-channel="stdout"
expression="'Removal of '" ></integration:transformer>
<integration:channel id="stdout"/>
<integration:service-activator input-channel="stdout"
ref="messageLogServiceWrapperImpl" method="log"/>

<integration:channel id="${provider_name}MessageLogChannel"/>

我想得到在 jdbc 中抛出的 MessageHandlingException,使用上面的 xml 文件我得到这个异常:

Exception in thread "main" `org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice#6acc3b9b' defined in Byte array resource [resource loaded from byte array]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [java.lang.String] to required type [org.springframework.messaging.MessageChannel] for property 'failureChannel'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.messaging.MessageChannel] for property 'failureChannel': no matching editors or conversion strategy found`

如何设置失败 channel ??????

最佳答案

你必须使用

 <property name="failureChannel" ref="failures"/>

相反。我的意思是ref对于 bean 引用,不是 value 。请参阅 <property> 中的描述XSD。

关于java - 如何使用 request-handler-advice-chain 和 ExpressionEvaluatingRequestHandlerAdvice?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44471091/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com