From a9d1beb7faccf72728c2b60ad0adcba59c555274 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 10 May 2013 17:14:39 +0300 Subject: [PATCH] INT-2783: Add BeanResolver to StoredProc params JIRA: https://jira.springsource.org/browse/INT-2783 --- .../integration/jdbc/StoredProcExecutor.java | 4 +++- ...atewayWithNamespaceIntegrationTests-context.xml | 4 +++- ...tboundGatewayWithNamespaceIntegrationTests.java | 14 +++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java index e768640cb4..47ddbe6655 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -59,6 +59,7 @@ import com.google.common.cache.LoadingCache; * provides the core functionality to execute those. * * @author Gunnar Hillert + * @author Artem Bilan * @since 2.1 * */ @@ -170,6 +171,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean { expressionSourceFactory.setStaticParameters(ProcedureParameter.convertStaticParameters(procedureParameters)); expressionSourceFactory.setParameterExpressions(ProcedureParameter.convertExpressions(procedureParameters)); + expressionSourceFactory.setBeanFactory(this.beanFactory); this.sqlParameterSourceFactory = expressionSourceFactory; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests-context.xml index e973c1e097..5bb5e4d791 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests-context.xml @@ -26,7 +26,7 @@ reply-channel="outputChannel"> - + @@ -54,4 +54,6 @@ + + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java index 26b587d096..17c7186004 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithNamespaceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,7 +96,7 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests { assertEquals("Wrong username", "myUsername", userFromDb.getUsername()); assertEquals("Wrong password", "myPassword", userFromDb.getPassword()); - assertEquals("Wrong email", "myEmail", userFromDb.getEmail()); + assertEquals("Wrong email", "'myEmail'", userFromDb.getEmail()); } @@ -134,7 +134,7 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests { //prevent message overload return null; } - return Integer.valueOf(count.incrementAndGet()); + return count.incrementAndGet(); } } @@ -152,4 +152,12 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests { return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS); } } + + static class TestService { + + public String quote(String s) { + return "'" + s + "'"; + } + } + }