迁移到Spring Integration 4.0.4 时,使用使用 GatewayProxyFactoryBean
创建的服务bean时会引发以下异常:
Sep 30, 2014 3:45:21 PM org.springframework.integration.expression.ExpressionUtils createStandardEvaluationContext
WARNING: Creating EvaluationContext with no beanFactory
java.lang.RuntimeException: No beanfactory
at org.springframework.integration.expression.ExpressionUtils.createStandardEvaluationContext(ExpressionUtils.java:79)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.createMethodInvocationEvaluationContext(GatewayMethodInboundMessageMapper.java:182)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.access$000(GatewayMethodInboundMessageMapper.java:77)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper$DefaultMethodArgsMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:279)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper$DefaultMethodArgsMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:272)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.mapArgumentsToMessage(GatewayMethodInboundMessageMapper.java:158)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:153)
at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:77)
at org.springframework.integration.support.converter.SimpleMessageConverter.toMessage(SimpleMessageConverter.java:82)
at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:112)
at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:103)
at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:241)
at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:220)
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:341)
at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:304)
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:295)
我们的设计广泛使用 GatewayProxyFactoryBean
,这个例外似乎是新的 . 在这种情况下,我们不使用任何SpEL表达式 . 如何避免这种异常?
2 回答
实际上它不是Exception,而只是
WARN
.从一侧您可以忽略它或降低
org.springframework.integration.expression.ExpressionUtils
类别的日志记录级别 .或者,当然,当你创建自己的
GatewayProxyFactoryBean
时,会更好甚至推荐什么,提供BeanFactory
并调用GatewayProxyFactoryBean
的afterPropertiesSet()
.这有点晚了,但正如@Artem Bilan建议的那样,你可以在你的log4j.xml文件中做这样的事情,假设你正在处理一个名为console的appender