Spring integration 存储过程出站网关空参数处理

Spring integration 存储过程出站网关空参数处理,spring-integration,Spring Integration,即使payload.second为null(可选参数),如何使此代码工作 谢谢你的跟踪。仔细看,我只看到了一个地方,当您无法获得参数-expressionEvaluationSqlParameterSourceFactory时: public boolean hasValue(String paramName) { try { Object value = doGetValue(paramName, true); if (value

即使payload.second为null(可选参数),如何使此代码工作


谢谢你的跟踪。仔细看,我只看到了一个地方,当您无法获得参数-
expressionEvaluationSqlParameterSourceFactory
时:

public boolean hasValue(String paramName) {
        try {
            Object value = doGetValue(paramName, true);
            if (value == ERROR) {
                return false;
            }
        }
        catch (ExpressionException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not evaluate expression", e);
            }
            if (this.cache) {
                values.put(paramName, ERROR);
            }
            return false;
        }
        return true;
    }
CallMetaDataContext\matchInParameterValuesWithCallParameters
无法填充第二个
参数,因为该
hasValue()
返回
false
。 而这只发生在
ExpressionException
的情况下

打开
org.springframework.integration.jdbc
类别的
DEBUG
日志记录,您将找到原因


我想你在这里只展示了简单的表达式(
payload.second
)表示法不会使这个问题复杂化。

请展示更多StackTrace。需要了解原因的根源。感谢Hanks Artem,我没有使用ExpressionEvaluationSqlParameterSourceFactory,但由于某种原因,在进行其他更改时,错误似乎已经消失,没有任何明显的更改。
   Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Required input parameter 'second' is missing
    at org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:211) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1115) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1173) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:381) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:342) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:190) ~[spring-jdbc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.integration.jdbc.StoredProcExecutor.executeStoredProcedureInternal(StoredProcExecutor.java:328) ~[spring-integration-jdbc-4.0.4.RELEASE.jar:na]
    at org.springframework.integration.jdbc.StoredProcExecutor.executeStoredProcedure(StoredProcExecutor.java:297) ~[spring-integration-jdbc-4.0.4.RELEASE.jar:na]
    at org.springframework.integration.jdbc.StoredProcOutboundGateway.handleRequestMessage(StoredProcOutboundGateway.java:60) ~[spring-integration-jdbc-4.0.4.RELEASE.jar:na]
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler$AdvisedRequestHandler.handleRequestMessage(AbstractReplyProducingMessageHandler.java:313) ~[spring-integration-core-4.0.4.RELEASE.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.0.7.RELEASE.jar:4.0.7.RELEASE]
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.cloneAndExecute(AbstractRequestHandlerAdvice.java:92) ~[spring-integration-core-4.0.4.RELEASE.jar:na]
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice$2.doWithRetry(RequestHandlerRetryAdvice.java:88) ~[spring-integration-core-4.0.4.RELEASE.jar:na]
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263) ~[spring-retry-1.1.1.RELEASE.jar:na]
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:193) ~[spring-retry-1.1.1.RELEASE.jar:na]
    at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.doInvoke(RequestHandlerRetryAdvice.java:85) ~[spring-integration-core-4.0.4.RELEASE.jar:na]
    ... 88 common frames omitted
public boolean hasValue(String paramName) {
        try {
            Object value = doGetValue(paramName, true);
            if (value == ERROR) {
                return false;
            }
        }
        catch (ExpressionException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not evaluate expression", e);
            }
            if (this.cache) {
                values.put(paramName, ERROR);
            }
            return false;
        }
        return true;
    }