我面临以下错误,使用spring版本5.3.14和Spring_integration 5.5.7,使用camel版本2.25.4。
org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.expression.Expression' for property 'onFailureExpression'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.springframework.expression.Expression' for property 'onFailureExpression': no matching editors or conversion strategy found
配置文件:
<int:filter id="xpathfilter" input-channel="eventSpringXpathChannel"
output-channel="eventSpringOutChannel" discard-channel="eventSpringFailureChannel"
expression="#xpath(payload, headers.get('xpathKey'), 'boolean')">
<int:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="onFailureExpression" value="payload" />
<property name="failureChannel" ref="eventSpringXpathErrorChannel" />
<property name="trapException" value="true" />
</bean>
</int:request-handler-advice-chain>
</int:filter>
这个setter需要一个org.springframework.expression.Expression
的实例,但是您只提供了value="payload"
,它确实不是Expression
。
参见另一个setter:
/**
* Set the expression to evaluate against the root message after a failed
* handler invocation. The exception is available as the variable {@code #exception}.
* Defaults to {@code payload}, if {@code failureChannel} is configured.
* @param onFailureExpression the SpEL expression.
* @since 4.3.7
*/
public void setOnFailureExpressionString(String onFailureExpression) {
所以,你的配置看起来像:
<property name="onFailureExpressionString" value="payload" />