Start 6.0 version
* Upgrade to Java 17, SF-6.0, Gradle 7.2 * Upgrade to Jakarta dependencies and respective namespaces * Fix some tests for Java 17 compatibility * Fix wrong Javadocs * Add some missed Javadocs * Fix more `jakarta` namespace * Fix WS & XML modules to use Jakarta EE * `--add-opens` in some modules for their reflection-based tests * Disable Kafka tests which does not work on Windows; see Apache Kafka `3.0.1` * Upgrade to JUnit `5.8.1` * Migrate JMS tests to Artemis * Remove RMI module as it was deprecated before * Fix `pr-build-workflow.yml` for Java 17 * Fix JavaDocs warnings using `Xdoclint:syntax` per module, not in the top-level `api` task * Move docs for version `6.0`
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -30,15 +30,13 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BeanPropertySqlParameterSourceFactory implements SqlParameterSourceFactory {
|
||||
|
||||
private volatile Map<String, Object> staticParameters;
|
||||
|
||||
public BeanPropertySqlParameterSourceFactory() {
|
||||
this.staticParameters = Collections.unmodifiableMap(new HashMap<String, Object>());
|
||||
}
|
||||
private Map<String, Object> staticParameters = Collections.unmodifiableMap(new HashMap<>());
|
||||
|
||||
/**
|
||||
* If the input is a List or a Map, the output is a map parameter source, and in that case some static parameters
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -58,9 +58,6 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre
|
||||
*/
|
||||
private final Map<String, Expression[]> parameterExpressions = new HashMap<>();
|
||||
|
||||
public ExpressionEvaluatingSqlParameterSourceFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Define some static parameter values. These take precedence over those defined as expressions in the
|
||||
* {@link #setParameterExpressions(Map) parameterExpressions}, so a parameter in the query will be filled from here
|
||||
|
||||
@@ -129,7 +129,10 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
this.keysGenerated = keysGenerated;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configure an {@link SqlParameterSourceFactory}.
|
||||
* @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use.
|
||||
*/
|
||||
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
this.sqlParameterSourceFactory = sqlParameterSourceFactory;
|
||||
}
|
||||
@@ -178,6 +181,12 @@ public class JdbcMessageHandler extends AbstractMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute an update for the provided message and generated keys flag.
|
||||
* @param message the message to use for update query params.
|
||||
* @param keysGenerated generate key or not.
|
||||
* @return a generated keys for udapte.
|
||||
*/
|
||||
protected List<? extends Map<String, Object>> executeUpdateQuery(final Message<?> message, boolean keysGenerated) {
|
||||
if (keysGenerated) {
|
||||
if (this.preparedStatementSetter != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -53,18 +53,40 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private Integer maxRows;
|
||||
|
||||
/**
|
||||
* Construct an instance based on the provided {@link DataSource} and update SQL.
|
||||
* @param dataSource the {@link DataSource} for execution.
|
||||
* @param updateQuery the query to execute.
|
||||
*/
|
||||
public JdbcOutboundGateway(DataSource dataSource, String updateQuery) {
|
||||
this(new JdbcTemplate(dataSource), updateQuery, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance based on the provided {@link DataSource}, select and update SQLs.
|
||||
* @param dataSource the {@link DataSource} for execution.
|
||||
* @param updateQuery the update to execute.
|
||||
* @param selectQuery the select to execute.
|
||||
*/
|
||||
public JdbcOutboundGateway(DataSource dataSource, String updateQuery, String selectQuery) {
|
||||
this(new JdbcTemplate(dataSource), updateQuery, selectQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance based on the provided {@link JdbcOperations} and update SQL.
|
||||
* @param jdbcOperations the {@link JdbcOperations} for execution.
|
||||
* @param updateQuery the query to execute.
|
||||
*/
|
||||
public JdbcOutboundGateway(JdbcOperations jdbcOperations, String updateQuery) {
|
||||
this(jdbcOperations, updateQuery, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance based on the provided {@link JdbcOperations}, select and update SQLs.
|
||||
* @param jdbcOperations the {@link JdbcOperations} for execution.
|
||||
* @param updateQuery the update to execute.
|
||||
* @param selectQuery the select to execute.
|
||||
*/
|
||||
public JdbcOutboundGateway(JdbcOperations jdbcOperations, String updateQuery, String selectQuery) {
|
||||
Assert.notNull(jdbcOperations, "'jdbcOperations' must not be null.");
|
||||
|
||||
@@ -95,7 +117,7 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
* The value is set on the underlying {@link JdbcPollingChannelAdapter}.
|
||||
* Also used to check before producing reply:
|
||||
* if result has only one item and {@code maxRows} is not set or configured to {@code 1},
|
||||
* only that item is returned. Otherwise the whole list.
|
||||
* only that item is returned. Otherwise, the whole list.
|
||||
* If not specified this value will default to {@code 1}.
|
||||
* This parameter is only applicable if a selectQuery was provided. Null values
|
||||
* are not permitted.
|
||||
@@ -117,21 +139,38 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler {
|
||||
this.keysGenerated = keysGenerated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a {@link SqlParameterSourceFactory} for update query.
|
||||
* @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use.
|
||||
*/
|
||||
public void setRequestSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
Assert.notNull(this.handler, "'handler' cannot be null");
|
||||
this.handler.setSqlParameterSourceFactory(sqlParameterSourceFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a {@link MessagePreparedStatementSetter} for update query.
|
||||
* @param requestPreparedStatementSetter the {@link MessagePreparedStatementSetter} to use.
|
||||
*/
|
||||
public void setRequestPreparedStatementSetter(MessagePreparedStatementSetter requestPreparedStatementSetter) {
|
||||
Assert.notNull(this.handler, "'handler' cannot be null");
|
||||
this.handler.setPreparedStatementSetter(requestPreparedStatementSetter);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set a {@link SqlParameterSourceFactory} for select query.
|
||||
* @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use.
|
||||
*/
|
||||
public void setReplySqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
this.sqlParameterSourceFactory = sqlParameterSourceFactory;
|
||||
this.sqlParameterSourceFactorySet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a select result {@link RowMapper}.
|
||||
* @param rowMapper the {@link RowMapper} to use.
|
||||
*/
|
||||
public void setRowMapper(RowMapper<?> rowMapper) {
|
||||
this.poller.setRowMapper(rowMapper);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -108,6 +108,10 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource<Object> {
|
||||
this.rowMapper = new ColumnMapRowMapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a {@link RowMapper}.
|
||||
* @param rowMapper the {@link RowMapper} to use.
|
||||
*/
|
||||
public void setRowMapper(@Nullable RowMapper<?> rowMapper) {
|
||||
this.rowMapper = rowMapper;
|
||||
if (rowMapper == null) {
|
||||
@@ -125,14 +129,26 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource<Object> {
|
||||
this.selectQuery = selectQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an update query.
|
||||
* @param updateSql the update query to use.
|
||||
*/
|
||||
public void setUpdateSql(String updateSql) {
|
||||
this.updateSql = updateSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a flag to update per record or not. Defaults to false.
|
||||
* @param updatePerRow the flag to control an update per record or whole batch.
|
||||
*/
|
||||
public void setUpdatePerRow(boolean updatePerRow) {
|
||||
this.updatePerRow = updatePerRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an {@link SqlParameterSourceFactory} for update query.
|
||||
* @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use.
|
||||
*/
|
||||
public void setUpdateSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
Assert.notNull(sqlParameterSourceFactory, "'sqlParameterSourceFactory' must be null.");
|
||||
this.sqlParameterSourceFactory = sqlParameterSourceFactory;
|
||||
@@ -194,6 +210,11 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource<Object> {
|
||||
return payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a select against provided {@link SqlParameterSource}.
|
||||
* @param sqlQueryParameterSource the {@link SqlParameterSource} to use. Optional.
|
||||
* @return the result of the query.
|
||||
*/
|
||||
protected List<?> doPoll(@Nullable SqlParameterSource sqlQueryParameterSource) {
|
||||
if (sqlQueryParameterSource != null) {
|
||||
return this.jdbcOperations.query(this.selectQuery, sqlQueryParameterSource, this.rowMapper);
|
||||
@@ -207,18 +228,9 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource<Object> {
|
||||
this.jdbcOperations.update(this.updateSql, this.sqlParameterSourceFactory.createParameterSource(obj));
|
||||
}
|
||||
|
||||
private static final class PreparedStatementCreatorWithMaxRows
|
||||
private record PreparedStatementCreatorWithMaxRows(PreparedStatementCreator delegate, int maxRows)
|
||||
implements PreparedStatementCreator, PreparedStatementSetter, SqlProvider, ParameterDisposer {
|
||||
|
||||
private final PreparedStatementCreator delegate;
|
||||
|
||||
private final int maxRows;
|
||||
|
||||
private PreparedStatementCreatorWithMaxRows(PreparedStatementCreator delegate, int maxRows) {
|
||||
this.delegate = delegate;
|
||||
this.maxRows = maxRows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
|
||||
PreparedStatement preparedStatement = this.delegate.createPreparedStatement(con);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2021 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.
|
||||
@@ -32,12 +32,20 @@ import org.springframework.messaging.Message;
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
* @see org.springframework.jdbc.core.PreparedStatementSetter
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface MessagePreparedStatementSetter {
|
||||
|
||||
/**
|
||||
* Set parameter values on the given {@link PreparedStatement} and message context.
|
||||
* @param ps the {@link PreparedStatement} to set value.
|
||||
* @param requestMessage the message as a context for values.
|
||||
* @throws SQLException if an SQLException is encountered
|
||||
*/
|
||||
void setValues(PreparedStatement ps, Message<?> requestMessage) throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,10 @@ public class JdbcLockRegistry implements ExpirableLockRegistry, RenewableLockReg
|
||||
|
||||
private int cacheCapacity = DEFAULT_CAPACITY;
|
||||
|
||||
public JdbcLockRegistry(LockRepository client) {
|
||||
/**
|
||||
* Construct an instance based on the provided {@link LockRepository}.
|
||||
* @param client the {@link LockRepository} to rely on.
|
||||
*/ public JdbcLockRegistry(LockRepository client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2021 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.
|
||||
@@ -25,19 +25,42 @@ import java.io.Closeable;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Alexandre Strubel
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.3
|
||||
*/
|
||||
public interface LockRepository extends Closeable {
|
||||
|
||||
/**
|
||||
* Check if a lock is held by this repository.
|
||||
* @param lock the lock to check.
|
||||
* @return acquired or not.
|
||||
*/
|
||||
boolean isAcquired(String lock);
|
||||
|
||||
/**
|
||||
* Remove a lock from this repository.
|
||||
* @param lock the lock to remove.
|
||||
*/
|
||||
void delete(String lock);
|
||||
|
||||
/**
|
||||
* Remove all the expired locks.
|
||||
*/
|
||||
void deleteExpired();
|
||||
|
||||
/**
|
||||
* Acquire a lock for a key.
|
||||
* @param lock the key for lock to acquire.
|
||||
* @return acquired or not.
|
||||
*/
|
||||
boolean acquire(String lock);
|
||||
|
||||
/**
|
||||
* Renew the lease for a lock.
|
||||
* @param lock the lock to renew.
|
||||
* @return renewed or not.
|
||||
*/
|
||||
boolean renew(String lock);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -336,6 +336,10 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
this.usingIdCache = usingIdCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a priority handling in this store.
|
||||
* @param priorityEnabled the priority handling enabled or not.
|
||||
*/
|
||||
public void setPriorityEnabled(boolean priorityEnabled) {
|
||||
this.priorityEnabled = priorityEnabled;
|
||||
}
|
||||
@@ -357,6 +361,10 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
this.messageGroupFactory = messageGroupFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link MessageGroupFactory}.
|
||||
* @return the {@link MessageGroupFactory}
|
||||
*/
|
||||
protected MessageGroupFactory getMessageGroupFactory() {
|
||||
return this.messageGroupFactory;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.messaging.Message;
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
@@ -41,6 +42,12 @@ public class MessageRowMapper implements RowMapper<Message<?>> {
|
||||
|
||||
private final LobHandler lobHandler;
|
||||
|
||||
/**
|
||||
* Construct an instance based on the provided {@link AllowListDeserializingConverter}
|
||||
* and {@link LobHandler}.
|
||||
* @param deserializer the {@link AllowListDeserializingConverter} to use.
|
||||
* @param lobHandler the {@link LobHandler} to use.
|
||||
*/
|
||||
public MessageRowMapper(AllowListDeserializingConverter deserializer, LobHandler lobHandler) {
|
||||
this.deserializer = deserializer;
|
||||
this.lobHandler = lobHandler;
|
||||
|
||||
Reference in New Issue
Block a user