INT-2039 removed references to deprecated Spring classes. Modified code where needed
This commit is contained in:
@@ -26,9 +26,9 @@ import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
*/
|
||||
public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
|
||||
private final SimpleJdbcOperations jdbcOperations;
|
||||
private final NamedParameterJdbcOperations jdbcOperations;
|
||||
|
||||
private volatile String updateSql;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
* @param updateSql query to execute
|
||||
*/
|
||||
public JdbcMessageHandler(DataSource dataSource, String updateSql) {
|
||||
this.jdbcOperations = new SimpleJdbcTemplate(dataSource);
|
||||
this.jdbcOperations = new NamedParameterJdbcTemplate(dataSource);
|
||||
this.updateSql = updateSql;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
* @param updateSql query to execute
|
||||
*/
|
||||
public JdbcMessageHandler(JdbcOperations jdbcOperations, String updateSql) {
|
||||
this.jdbcOperations = new SimpleJdbcTemplate(jdbcOperations);
|
||||
this.jdbcOperations = new NamedParameterJdbcTemplate(jdbcOperations);
|
||||
this.updateSql = updateSql;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
}
|
||||
if (keysGenerated) {
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
this.jdbcOperations.getNamedParameterJdbcOperations().update(this.updateSql, updateParameterSource,
|
||||
this.jdbcOperations.update(this.updateSql, updateParameterSource,
|
||||
keyHolder);
|
||||
return keyHolder.getKeyList();
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.RowMapperResultSetExtractor;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
|
||||
/**
|
||||
* A polling channel adapter that creates messages from the payload returned by
|
||||
@@ -48,7 +48,7 @@ import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
*/
|
||||
public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implements MessageSource<Object> {
|
||||
|
||||
private final SimpleJdbcOperations jdbcOperations;
|
||||
private final NamedParameterJdbcOperations jdbcOperations;
|
||||
|
||||
private final String selectQuery;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen
|
||||
* @param selectQuery query to execute
|
||||
*/
|
||||
public JdbcPollingChannelAdapter(DataSource dataSource, String selectQuery) {
|
||||
this.jdbcOperations = new SimpleJdbcTemplate(dataSource);
|
||||
this.jdbcOperations = new NamedParameterJdbcTemplate(dataSource);
|
||||
this.selectQuery = selectQuery;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen
|
||||
* @param selectQuery query to execute
|
||||
*/
|
||||
public JdbcPollingChannelAdapter(JdbcOperations jdbcOperations, String selectQuery) {
|
||||
this.jdbcOperations = new SimpleJdbcTemplate(jdbcOperations);
|
||||
this.jdbcOperations = new NamedParameterJdbcTemplate(jdbcOperations);
|
||||
this.selectQuery = selectQuery;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class JdbcPollingChannelAdapter extends IntegrationObjectSupport implemen
|
||||
}
|
||||
|
||||
if (sqlQueryParameterSource != null) {
|
||||
payload = this.jdbcOperations.getNamedParameterJdbcOperations().query(this.selectQuery,
|
||||
payload = this.jdbcOperations.query(this.selectQuery,
|
||||
sqlQueryParameterSource, resultSetExtractor);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user