Merge pull request #804 from artembilan/INT-2783
* artembilan-INT-2783: INT-2783: Add BeanResolver to StoredProc params
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
reply-channel="outputChannel">
|
||||
<int-jdbc:parameter name="username" expression="payload.username"/>
|
||||
<int-jdbc:parameter name="password" expression="payload.password"/>
|
||||
<int-jdbc:parameter name="email" expression="payload.email"/>
|
||||
<int-jdbc:parameter name="email" expression="@testService.quote(payload.email)"/>
|
||||
<int-jdbc:returning-resultset name="out" row-mapper="org.springframework.integration.jdbc.storedproc.UserMapper" />
|
||||
</int-jdbc:stored-proc-outbound-gateway>
|
||||
|
||||
@@ -54,4 +54,6 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="testService" class="org.springframework.integration.jdbc.StoredProcOutboundGatewayWithNamespaceIntegrationTests$TestService"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -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 + "'";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user