From 177bda58c55ecd6907b84d4c6c3848b4fb2b7eba Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 8 Jan 2025 12:28:56 -0500 Subject: [PATCH] GH-9744: Remove deprecated `LobHandler` references Fixes: https://github.com/spring-projects/spring-integration/issues/9744 --- .../jdbc/config/JdbcMessageStoreParser.java | 20 +++++++------------ .../jdbc/store/JdbcChannelMessageStore.java | 13 +----------- .../jdbc/store/JdbcMessageStore.java | 12 ----------- ...elMessageStorePreparedStatementSetter.java | 18 +---------------- .../jdbc/store/channel/MessageRowMapper.java | 16 +-------------- .../jdbc/config/spring-integration-jdbc.xsd | 13 ------------ 6 files changed, 10 insertions(+), 82 deletions(-) diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java index 6bc58e1867..780c49d8ca 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2025 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,17 +30,17 @@ import org.springframework.util.StringUtils; * Parser for {@link JdbcMessageStore}. * * @author Dave Syer + * @author Artem Bilan + * * @since 2.0 */ public class JdbcMessageStoreParser extends AbstractBeanDefinitionParser { @Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { - Object source = parserContext.extractSource(element); - BeanDefinitionBuilder builder = BeanDefinitionBuilder - .genericBeanDefinition(JdbcMessageStore.class); + BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JdbcMessageStore.class); String dataSourceRef = element.getAttribute("data-source"); String simpleJdbcOperationsRef = element.getAttribute("jdbc-operations"); @@ -53,18 +53,12 @@ public class JdbcMessageStoreParser extends AbstractBeanDefinitionParser { + "simple-jdbc-operations should be set for the JDBC message-store", source); } - if (refToDataSourceSet) { - builder.addConstructorArgReference(dataSourceRef); - } - else { - builder.addConstructorArgReference(simpleJdbcOperationsRef); - } + builder.addConstructorArgReference(refToDataSourceSet ? dataSourceRef : simpleJdbcOperationsRef); - IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "lob-handler"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "serializer"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "deserializer"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "table-prefix", "tablePrefix"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "region", "region"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "table-prefix"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "region"); return builder.getBeanDefinition(); diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java index 86d74db44e..accc53bed1 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -51,7 +51,6 @@ import org.springframework.integration.util.UUIDConverter; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.jdbc.support.lob.LobHandler; import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.jmx.export.annotation.ManagedMetric; import org.springframework.jmx.export.annotation.ManagedResource; @@ -225,16 +224,6 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto this.jdbcTemplate = jdbcTemplate; } - /** - * Override the {@link LobHandler} that is used to create and unpack large objects in SQL queries. The default is - * fine for almost all platforms, but some Oracle drivers require a native implementation. - * @param lobHandler a {@link LobHandler} - * @deprecated since 6.4 (for removal) (with no replacement) in favor of plain JDBC driver support for byte arrays. - */ - @Deprecated(forRemoval = true, since = "6.4") - public void setLobHandler(LobHandler lobHandler) { - } - /** * Allow for passing in a custom {@link MessageRowMapper}. The {@link MessageRowMapper} * is used to convert the selected database row representing the persisted diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java index 73d0f99760..79e2baa5cb 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java @@ -49,7 +49,6 @@ import org.springframework.integration.util.UUIDConverter; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SingleColumnRowMapper; -import org.springframework.jdbc.support.lob.LobHandler; import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.lang.Nullable; import org.springframework.messaging.Message; @@ -318,17 +317,6 @@ public class JdbcMessageStore extends AbstractMessageGroupStore this.region = region; } - /** - * Override the {@link LobHandler} that is used to create and unpack large objects in SQL queries. The default is - * fine for almost all platforms, but some Oracle drivers require a native implementation. - * @param lobHandler a {@link LobHandler} - * @deprecated since 6.4 (for removal) (with no replacement) in favor of plain JDBC driver support for byte arrays. - */ - @Deprecated(forRemoval = true, since = "6.4") - public void setLobHandler(LobHandler lobHandler) { - - } - /** * A converter for serializing messages to byte arrays for storage. * @param serializer the serializer to set diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/ChannelMessageStorePreparedStatementSetter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/ChannelMessageStorePreparedStatementSetter.java index acb7944ccd..25a23837dc 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/ChannelMessageStorePreparedStatementSetter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/ChannelMessageStorePreparedStatementSetter.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 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. @@ -24,7 +24,6 @@ import java.util.Objects; import org.springframework.core.serializer.support.SerializingConverter; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.util.UUIDConverter; -import org.springframework.jdbc.support.lob.LobHandler; import org.springframework.messaging.Message; import org.springframework.util.Assert; @@ -53,21 +52,6 @@ public class ChannelMessageStorePreparedStatementSetter { private final SerializingConverter serializer; - /** - * Instantiate a {@link ChannelMessageStorePreparedStatementSetter} with the provided - * serializer and lobHandler, which both must not be null. - * @param serializer the {@link SerializingConverter} to build {@code byte[]} from - * the request message - * @param lobHandler the {@link LobHandler} to store {@code byte[]} of the request - * message to prepared statement - * @deprecated since 6.4 (for removal) (if favor of {@link #ChannelMessageStorePreparedStatementSetter(SerializingConverter)}) - * with a plain JDBC driver support for byte arrays. - */ - @Deprecated(forRemoval = true, since = "6.4") - public ChannelMessageStorePreparedStatementSetter(SerializingConverter serializer, LobHandler lobHandler) { - this(serializer); - } - /** * Instantiate a {@link ChannelMessageStorePreparedStatementSetter} with the provided * serializer and lobHandler, which both must not be null. diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java index c054bebb8f..3a180c1ca8 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -21,7 +21,6 @@ import java.sql.SQLException; import org.springframework.integration.support.converter.AllowListDeserializingConverter; import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.support.lob.LobHandler; import org.springframework.messaging.Message; import org.springframework.util.Assert; @@ -41,19 +40,6 @@ public class MessageRowMapper implements RowMapper> { private final AllowListDeserializingConverter deserializer; - /** - * 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. - * @deprecated since 6.4 (for removal) (if favor of {@link #MessageRowMapper(AllowListDeserializingConverter)}) - * with a plain JDBC driver support for byte arrays. - */ - @Deprecated(forRemoval = true, since = "6.4") - public MessageRowMapper(AllowListDeserializingConverter deserializer, LobHandler lobHandler) { - this(deserializer); - } - /** * Construct an instance based on the provided {@link AllowListDeserializingConverter}. * @param deserializer the {@link AllowListDeserializingConverter} to use. diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc.xsd b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc.xsd index 9faabad47e..3a9375b657 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc.xsd +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc.xsd @@ -80,19 +80,6 @@ - - - - - - - - - -