Spring json 路径表达式的集成转换错误

Spring Integration transformation error with json path expression

我的 spring 集成正在尝试转换来自输入通道的 JSON 消息,并通过提供相应的键从 JSON 消息中提取值。它抛出 SpelEvaluationException。

Spring 集成配置

<int:object-to-json-transformer input-channel="inputEventChannel" output-channel="jsonMapChannel"/>

<int:transformer input-channel="jsonMapChannel" output-channel="transformChannel" 
     expression="#jsonPath(payload, '$.[0].EVENTNAME')"/>

错误信息

Caused by: org.springframework.messaging.MessageHandlingException: Expression evaluation failed: #jsonPath(payload, '$.[0].EVENTNAME'); nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1022E: The function 'jsonPath' mapped to an object of type 'class org.springframework.expression.TypedValue' which cannot be invoked, failedMessage=GenericMessage [payload=[{"EVENTID":5064015,"EVENTNAME":"Account","EVENTID":"15590","APPLICATIONID":1,"CREATEDTIMESTAMP":1493929367000,"TRANSACTIONID":"100.2.33"}], headers={json__ContentTypeId__=class org.springframework.util.LinkedCaseInsensitiveMap, id=acbc053a-b466-fbb9-8d3d-f60c78371b3e, json__TypeId__=class java.util.ArrayList, contentType=application/json, timestamp=1493933245720}]

我可以知道这里出了什么问题吗?我什至也尝试过这个。相同的错误行为。

#jsonPath(payload, '$.EVENTNAME')

谢谢。

EL1022E表示jsonPath函数没有注册为函数

这意味着 JsonPath jar 不在类路径中。

DEBUG 日志记录应显示此日志...

logger.debug("The '#jsonPath' SpEL function cannot be registered: " +
        "there is no jayway json-path.jar on the classpath.");