我正在使用 Spring-Integration 3.0 和 Spring-Integration Gemfire 支持。我希望我的入站通道适配器根据 SpEL 表达式将缓存中的对象作为有效负载提取。我编写了一个自定义表达式评估器类来检查输入适配器选择的有效负载的属性。类代码如下:
@Component
public class GraphMatchingUtil {
public static boolean evaluate(NodeGraph nodeGraph){
if(nodeGraph.getLastProcessedTS()!=null){
if(nodeGraph.getLastProcessedTS().getTime() - DateTimeUtil.createTimestamp().getTime() > 100000){
return true;
}
}
else{
if(nodeGraph.getCreateTS().getTime() - DateTimeUtil.createTimestamp().getTime() > 100000){
return true;
}
}
return false;
}
}
配置代码如下
<int:spel-function id="match" class="com.equ.util.GraphMatchingUtil" method="evaluate(com.equ.bo.NodeGraph)"/>
<int-gfe:inbound-channel-adapter id="graphadapter" channel="reconchannel" region="cacheRegion" cache-events="CREATED, UPDATED" expression="@match(payload)==true"/>
但是,执行此代码后出现以下错误:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphadapter': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'payloadExpression' threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1041E:(pos 6): After parsing a valid expression, there is still more data in the expression: 'lparen(()'
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'payloadExpression' threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1041E:(pos 6): After parsing a valid expression, there is still more data in the expression: 'lparen(()'
谁能帮我理解它有什么问题?
用#替换@后,我得到了这个错误:
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'payload' cannot be found on object of type 'com.gemstone.gemfire.internal.cache.EntryEventImpl'