【发布时间】:2015-11-13 00:20:27
【问题描述】:
我的 spring-integration 上下文文件中有以下 sn-p:
<int:header-enricher input-channel="headerEnricherChannel"
output-channel="xpathHeaderEnricherChannel">
<!-- java.io.File -->
<int:header name="DecryptedRequestFile" expression="payload" />
<!-- java.lang.String -->
<int:header name="RequestFileName" expression="payload.getName()" />
<int:header name="Priority"
expression="#xpath(payload, '//RequestType') == 'SDR_CIRCLE' ? 'SDR_CIRCLE' : #xpath(payload, '//Priority')" />
<int:header name="savedPayload" expression="payload" />
**<int:header name="RequestFileAsString"
expression="#{ T(org.apache.commons.io.FileUtils).readFileToString(payload) }" />**
</int:header-enricher>
headerEnricherChannel 的输入消息的有效负载是java.io.File。我想使用 Apache FileUtils 将此有效负载转换为字符串。但是,这样做会引发如下错误。请有人指出我正确的方向吗?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.transformer.HeaderEnricher#0': Cannot create inner bean '(inner bean)#38a1aa85' of type [org.springframework.integration.transformer.support.ExpressionEvaluatingHeaderValueMessageProcessor] while setting constructor argument with key [RequestFileAsString]; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 35): Property or field 'payload' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public?
【问题讨论】:
标签: spring-integration spring-el