From 6f9809eba122b5cef2bf0433e1abfd0961b68d86 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 27 Sep 2024 16:41:56 +0200 Subject: [PATCH] Fix depreactions --- .../properties/KafkaConsumerProperties.java | 87 ------------------- .../kafka/KafkaMessageChannelBinder.java | 44 +--------- .../stream/binder/kafka/KafkaBinderTests.java | 1 - .../KafkaBinderExtendedPropertiesTest.java | 3 - .../RabbitBinderConfigurationProperties.java | 15 ---- .../properties/RabbitConsumerProperties.java | 36 -------- .../properties/RabbitProducerProperties.java | 18 ---- .../binder/rabbit/RabbitBinderTests.java | 2 +- .../stream/binder/test/InputDestination.java | 10 --- .../cloud/stream/binder/PartitionHandler.java | 18 ---- .../config/BindingServiceProperties.java | 29 ------- .../avro/AbstractAvroMessageConverter.java | 11 --- .../avro/AvroSchemaMessageConverter.java | 30 ------- ...oSchemaRegistryClientMessageConverter.java | 19 ---- .../avro/AvroSchemaServiceManagerTests.java | 12 +-- .../controllers/ServerController.java | 21 ----- .../server/SchemaRegistryServerAvroTests.java | 2 +- 17 files changed, 5 insertions(+), 353 deletions(-) diff --git a/binders/kafka-binder/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java b/binders/kafka-binder/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java index d6f6205bc1..11c1c3c20c 100644 --- a/binders/kafka-binder/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java +++ b/binders/kafka-binder/spring-cloud-stream-binder-kafka-core/src/main/java/org/springframework/cloud/stream/binder/kafka/properties/KafkaConsumerProperties.java @@ -86,12 +86,6 @@ public enum StandardHeaders { } - /** - * When true the offset is committed after each record, otherwise the offsets for the complete set of records - * received from the poll() are committed after all records have been processed. - */ - @Deprecated - private boolean ackEachRecord; /** * When true, topic partitions is automatically rebalanced between the members of a consumer group. @@ -99,14 +93,6 @@ public enum StandardHeaders { */ private boolean autoRebalanceEnabled = true; - /** - * Whether to autocommit offsets when a message has been processed. - * If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header - * is present in the inbound message. Applications may use this header for acknowledging messages. - */ - @Deprecated - private boolean autoCommitOffset = true; - /** * Controlling the container acknowledgement mode. This is the preferred way to control the ack mode on the * container instead of the deprecated autoCommitOffset property. @@ -152,12 +138,6 @@ public enum StandardHeaders { */ private KafkaProducerProperties dlqProducerProperties = new KafkaProducerProperties(); - /** - * @deprecated No longer used by the binder. - */ - @Deprecated - private int recoveryInterval = 5000; - /** * List of trusted packages to provide the header mapper. */ @@ -230,53 +210,6 @@ public enum StandardHeaders { */ private boolean reactiveAtMostOnce; - /** - * @return if each record needs to be acknowledged. - * - * When true the offset is committed after each record, otherwise the offsets for the complete set of records - * received from the poll() are committed after all records have been processed. - * - * @deprecated since 3.1 in favor of using {@link #ackMode} - */ - @Deprecated - public boolean isAckEachRecord() { - return this.ackEachRecord; - } - - /** - * @param ackEachRecord - * - * @deprecated in favor of using {@link #ackMode} - */ - @Deprecated - public void setAckEachRecord(boolean ackEachRecord) { - this.ackEachRecord = ackEachRecord; - } - - /** - * @return is autocommit offset enabled - * - * Whether to autocommit offsets when a message has been processed. - * If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header - * is present in the inbound message. Applications may use this header for acknowledging messages. - * - * @deprecated since 3.1 in favor of using {@link #ackMode} - */ - @Deprecated - public boolean isAutoCommitOffset() { - return this.autoCommitOffset; - } - - /** - * @param autoCommitOffset - * - * @deprecated in favor of using {@link #ackMode} - */ - @Deprecated - public void setAutoCommitOffset(boolean autoCommitOffset) { - this.autoCommitOffset = autoCommitOffset; - } - /** * @return Container's ack mode. */ @@ -348,26 +281,6 @@ public void setAutoCommitOnError(Boolean autoCommitOnError) { this.autoCommitOnError = autoCommitOnError; } - /** - * No longer used. - * @return the interval. - * @deprecated No longer used by the binder - */ - @Deprecated - public int getRecoveryInterval() { - return this.recoveryInterval; - } - - /** - * No longer used. - * @param recoveryInterval the interval. - * @deprecated No longer needed by the binder - */ - @Deprecated - public void setRecoveryInterval(int recoveryInterval) { - this.recoveryInterval = recoveryInterval; - } - /** * @return is auto rebalance enabled * diff --git a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java index 2e1249ae80..0b4d6f29b7 100644 --- a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java +++ b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java @@ -321,18 +321,6 @@ public void setProducerListener(ProducerListener producerListene this.producerListener = producerListener; } - /** - * Set a {@link ClientFactoryCustomizer} for the {@link ProducerFactory} and {@link ConsumerFactory} created inside - * the binder. - * - * @param customizer the client factory customizer - * @deprecated in favor of {@link #addClientFactoryCustomizer(ClientFactoryCustomizer)}. - */ - @Deprecated - public void setClientFactoryCustomizer(ClientFactoryCustomizer customizer) { - addClientFactoryCustomizer(customizer); - } - public void addClientFactoryCustomizer(ClientFactoryCustomizer customizer) { if (customizer != null) { this.clientFactoryCustomizers.add(customizer); @@ -686,17 +674,7 @@ else if (applicationContext != null) { messageListenerContainer.setBeanName(destination + ".container"); // end of these won't be needed... ContainerProperties.AckMode ackMode = extendedConsumerProperties.getExtension().getAckMode(); - if (ackMode == null) { - if (extendedConsumerProperties.getExtension().isAckEachRecord()) { - ackMode = ContainerProperties.AckMode.RECORD; - } - else { - if (!extendedConsumerProperties.getExtension().isAutoCommitOffset()) { - messageListenerContainer.getContainerProperties() - .setAckMode(ContainerProperties.AckMode.MANUAL); - } - } - } + if (ackMode != null) { if ((extendedConsumerProperties.isBatchMode() && ackMode != ContainerProperties.AckMode.RECORD) || !extendedConsumerProperties.isBatchMode()) { @@ -1425,32 +1403,12 @@ private String getStackTraceAsString(Throwable cause) { return stringWriter.getBuffer().toString(); } - /** - * Set a {@link ConsumerConfigCustomizer} for the {@link ConsumerFactory} created inside the binder. - * @param consumerConfigCustomizer the consumer config customizer - * @deprecated in favor of {@link #addConsumerConfigCustomizer(ConsumerConfigCustomizer)}. - */ - @Deprecated - public void setConsumerConfigCustomizer(ConsumerConfigCustomizer consumerConfigCustomizer) { - addConsumerConfigCustomizer(consumerConfigCustomizer); - } - public void addConsumerConfigCustomizer(ConsumerConfigCustomizer consumerConfigCustomizer) { if (consumerConfigCustomizer != null) { this.consumerConfigCustomizers.add(consumerConfigCustomizer); } } - /** - * Set a {@link ProducerConfigCustomizer} for the {@link ProducerFactory} created inside the binder. - * @param producerConfigCustomizer the producer config customizer - * @deprecated in favor of {@link #addProducerConfigCustomizer(ProducerConfigCustomizer)}. - */ - @Deprecated - public void setProducerConfigCustomizer(ProducerConfigCustomizer producerConfigCustomizer) { - addProducerConfigCustomizer(producerConfigCustomizer); - } - public void addProducerConfigCustomizer(ProducerConfigCustomizer producerConfigCustomizer) { if (producerConfigCustomizer != null) { this.producerConfigCustomizers.add(producerConfigCustomizer); diff --git a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java index 311499d382..06aced0543 100644 --- a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java +++ b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderTests.java @@ -1515,7 +1515,6 @@ void autoCommitOnErrorWhenManualAcknowledgement() throws Exception { consumerProperties.setBackOffMaxInterval(150); //When auto commit is disabled, then the record is committed after publishing to DLQ using the manual acknowledgement. // (if DLQ is enabled, which is, in this case). - consumerProperties.getExtension().setAutoCommitOffset(false); consumerProperties.getExtension().setEnableDlq(true); DirectChannel moduleInputChannel = createBindableChannel("input", diff --git a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java index 91ccb97813..bb89e6caf1 100644 --- a/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java +++ b/binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/integration/KafkaBinderExtendedPropertiesTest.java @@ -136,9 +136,6 @@ void kafkaBinderExtendedProperties() throws Exception { customKafkaConsumerProperties.getConfiguration().get("value.serializer")) .isEqualTo("BarSerializer.class"); - assertThat(kafkaConsumerProperties.isAckEachRecord()).isEqualTo(true); - assertThat(customKafkaConsumerProperties.isAckEachRecord()).isEqualTo(false); - RebalanceListener rebalanceListener = context.getBean(RebalanceListener.class); assertThat(rebalanceListener.latch.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(rebalanceListener.bindings.keySet()).contains("standard-in", diff --git a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitBinderConfigurationProperties.java b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitBinderConfigurationProperties.java index b13fe5c030..d8ccc69747 100644 --- a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitBinderConfigurationProperties.java +++ b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitBinderConfigurationProperties.java @@ -54,21 +54,6 @@ public void setAdminAddresses(String[] adminAddresses) { this.adminAddresses = adminAddresses; } - /** - * @param adminAddresses A comma-separated list of RabbitMQ management plugin URLs. - * @deprecated in favor of {@link #setAdminAddresses(String[])}. Will be removed in a - * future release. - */ - @Deprecated - public void setAdminAdresses(String[] adminAddresses) { - setAdminAddresses(adminAddresses); - } - - @Deprecated - public String[] getAdminAdresses() { - return this.adminAddresses; - } - public String[] getNodes() { return nodes; } diff --git a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitConsumerProperties.java b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitConsumerProperties.java index 25ae65a842..f68ef828bf 100644 --- a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitConsumerProperties.java +++ b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitConsumerProperties.java @@ -180,42 +180,6 @@ public void setPrefetch(int prefetch) { this.prefetch = prefetch; } - /** - * @return the header patterns. - * @deprecated - use {@link #getHeaderPatterns()}. - */ - @Deprecated - public String[] getRequestHeaderPatterns() { - return this.headerPatterns; - } - - /** - * @param requestHeaderPatterns request header patterns - * @deprecated - use {@link #setHeaderPatterns(String[])}. - */ - @Deprecated - public void setRequestHeaderPatterns(String[] requestHeaderPatterns) { - this.headerPatterns = requestHeaderPatterns; - } - - /** - * @return the tx size. - * @deprecated in favor of {@link #getBatchSize()} - */ - @Deprecated - @Min(value = 1, message = "Tx Size should be greater than zero.") - public int getTxSize() { - return getBatchSize(); - } - - /** - * @param txSize the tx size - * deprecated in favor of {@link #setBatchSize(int)}. - */ - public void setTxSize(int txSize) { - setBatchSize(txSize); - } - @Min(value = 1, message = "Batch Size should be greater than zero.") public int getBatchSize() { return batchSize; diff --git a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitProducerProperties.java b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitProducerProperties.java index 678eb7c9d4..674867bce2 100644 --- a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitProducerProperties.java +++ b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit-core/src/main/java/org/springframework/cloud/stream/binder/rabbit/properties/RabbitProducerProperties.java @@ -163,24 +163,6 @@ public enum ProducerType { */ private boolean superStream; - /** - * @param requestHeaderPatterns the patterns. - * @deprecated - use {@link #setHeaderPatterns(String[])}. - */ - @Deprecated - public void setRequestHeaderPatterns(String[] requestHeaderPatterns) { - this.headerPatterns = requestHeaderPatterns; - } - - /** - * @return the header patterns. - * @deprecated - use {@link #getHeaderPatterns()}. - */ - @Deprecated - public String[] getRequestHeaderPatterns() { - return this.headerPatterns; - } - public void setCompress(boolean compress) { this.compress = compress; } diff --git a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java index 0d616f170c..39348ce8c1 100644 --- a/binders/rabbit-binder/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java +++ b/binders/rabbit-binder/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java @@ -499,7 +499,7 @@ void consumerProperties() throws Exception { properties.getExtension().setPrefix("foo."); properties.getExtension().setPrefetch(20); properties.getExtension().setHeaderPatterns(new String[] { "foo" }); - properties.getExtension().setTxSize(10); + properties.getExtension().setBatchSize(10); QuorumConfig quorum = properties.getExtension().getQuorum(); quorum.setEnabled(true); quorum.setDeliveryLimit(10); diff --git a/core/spring-cloud-stream-test-binder/src/main/java/org/springframework/cloud/stream/binder/test/InputDestination.java b/core/spring-cloud-stream-test-binder/src/main/java/org/springframework/cloud/stream/binder/test/InputDestination.java index 27d562c7d0..74c9ea672c 100644 --- a/core/spring-cloud-stream-test-binder/src/main/java/org/springframework/cloud/stream/binder/test/InputDestination.java +++ b/core/spring-cloud-stream-test-binder/src/main/java/org/springframework/cloud/stream/binder/test/InputDestination.java @@ -37,16 +37,6 @@ public void send(Message message) { this.getChannel(0).send(message); } - /** - * @param message message to send - * @param inputIndex input index - * @deprecated since 3.0.2 in favor of {@link #receive(long, String)} where you should use the actual binding name (e.g., "foo-in-0") - */ - @Deprecated - public void send(Message message, int inputIndex) { - this.getChannel(inputIndex).send(message); - } - /** * Allows the {@link Message} to be sent to a Binder's destination.
* This needs a bit of clarification. Just like with any binder, 'destination' diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/PartitionHandler.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/PartitionHandler.java index a369fcef6d..b050c3b14a 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/PartitionHandler.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/PartitionHandler.java @@ -56,24 +56,6 @@ public class PartitionHandler { private volatile int partitionCount; - /** - * Construct a {@code PartitionHandler}. - * @param evaluationContext evaluation context for binder - * @param properties binder properties - * @param partitionKeyExtractorStrategy PartitionKeyExtractor strategy - * @param partitionSelectorStrategy PartitionSelector strategy - * - * @deprecated since 3.0.2. Please use another constructor which allows you to pass an instance of beanFactory - */ - @Deprecated - public PartitionHandler(EvaluationContext evaluationContext, - ProducerProperties properties, - PartitionKeyExtractorStrategy partitionKeyExtractorStrategy, - PartitionSelectorStrategy partitionSelectorStrategy) { - - this(evaluationContext, properties, (ConfigurableListableBeanFactory) extractBeanFactoryFromEvaluationContext(evaluationContext)); - } - /** * Construct a {@code PartitionHandler}. * @param evaluationContext evaluation context for binder diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java index 514b67b734..341d4ef7b2 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java @@ -44,7 +44,6 @@ import org.springframework.core.convert.support.GenericConversionService; import org.springframework.integration.support.utils.IntegrationUtils; import org.springframework.util.Assert; -import org.springframework.util.StringUtils; /** * @author Dave Syer @@ -62,15 +61,6 @@ public class BindingServiceProperties private static final int DEFAULT_BINDING_RETRY_INTERVAL = 30; - /** - * A semi-colon delimited string representing the names of the sources based on which source bindings will be created. - * This is primarily to support cases where source binding may be required without providing a corresponding Supplier. - * (e.g., for cases where the actual source of data is outside of scope of spring-cloud-stream - HTTP -> Stream) - * @deprecated use {@link #outputBindings} - */ - @Deprecated - private String source; - /** * A semi-colon delimited string to explicitly define input bindings (specifically for cases when there * is no implicit trigger to create such bindings such as Function, Supplier or Consumer). @@ -308,23 +298,6 @@ public void setBindingRetryInterval(int bindingRetryInterval) { this.bindingRetryInterval = bindingRetryInterval; } - /** - * @deprecated in favor of {@link #getOutputBindings()} - */ - @Deprecated - public String getSource() { - return source; - } - - /** - * @deprecated in favor of {@link #setOutputBindings()} - */ - @Deprecated - public void setSource(String source) { - this.source = source; - this.outputBindings = source; - } - public void updateProducerProperties(String bindingName, ProducerProperties producerProperties) { if (this.bindings.containsKey(bindingName)) { @@ -354,8 +327,6 @@ public String getOutputBindings() { } public void setOutputBindings(String outputBindings) { - Assert.state(!StringUtils.hasText(this.source), "Setting 'source' and 'output-binding' is not allowed " - + "because 'source' is deprecated in favor of 'output-binding'."); this.outputBindings = outputBindings; } diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AbstractAvroMessageConverter.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AbstractAvroMessageConverter.java index 95df97f503..2b674e8afc 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AbstractAvroMessageConverter.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AbstractAvroMessageConverter.java @@ -51,21 +51,10 @@ public abstract class AbstractAvroMessageConverter extends AbstractMessageConver private Schema.Parser schemaParser = new Schema.Parser(); private AvroSchemaServiceManager avroSchemaServiceManager; - @Deprecated - protected AbstractAvroMessageConverter(MimeType supportedMimeType) { - this(Collections.singletonList(supportedMimeType), new AvroSchemaServiceManagerImpl()); - } - protected AbstractAvroMessageConverter(MimeType supportedMimeType, AvroSchemaServiceManager avroSchemaServiceManager) { this(Collections.singletonList(supportedMimeType), avroSchemaServiceManager); } - @Deprecated - protected AbstractAvroMessageConverter(Collection supportedMimeTypes) { - this(supportedMimeTypes, new AvroSchemaServiceManagerImpl()); - setContentTypeResolver(new OriginalContentTypeResolver()); - } - protected AbstractAvroMessageConverter(Collection supportedMimeTypes, AvroSchemaServiceManager manager) { super(supportedMimeTypes); setContentTypeResolver(new OriginalContentTypeResolver()); diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaMessageConverter.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaMessageConverter.java index 69247a08a4..ad68bff38f 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaMessageConverter.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaMessageConverter.java @@ -41,15 +41,6 @@ public class AvroSchemaMessageConverter extends AbstractAvroMessageConverter { private Schema schema; - /** - * Create a {@link AvroSchemaMessageConverter}. Uses the default {@link MimeType} of - * {@code "application/avro"}. - */ - @Deprecated - public AvroSchemaMessageConverter() { - super(new MimeType("application", "avro")); - } - /** * Create a {@link AvroSchemaMessageConverter}. Uses the default {@link MimeType} of * {@code "application/avro"}. @@ -59,17 +50,6 @@ public AvroSchemaMessageConverter(AvroSchemaServiceManager manager) { super(new MimeType("application", "avro"), manager); } - /** - * Create a {@link AvroSchemaMessageConverter}. The converter will be used for the - * provided {@link MimeType}. - * @param supportedMimeType mime type to be supported by - * {@link AvroSchemaMessageConverter} - */ - @Deprecated - public AvroSchemaMessageConverter(MimeType supportedMimeType) { - super(supportedMimeType); - } - /** * Create a {@link AvroSchemaMessageConverter}. The converter will be used for the * provided {@link MimeType}. @@ -81,16 +61,6 @@ public AvroSchemaMessageConverter(MimeType supportedMimeType, AvroSchemaServiceM super(supportedMimeType, manager); } - /** - * Create a {@link AvroSchemaMessageConverter}. The converter will be used for the - * provided {@link MimeType}s. - * @param supportedMimeTypes the mime types supported by this converter - */ - @Deprecated - public AvroSchemaMessageConverter(Collection supportedMimeTypes) { - super(supportedMimeTypes); - } - /** * Create a {@link AvroSchemaMessageConverter}. The converter will be used for the * provided {@link MimeType}s. diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaRegistryClientMessageConverter.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaRegistryClientMessageConverter.java index ff45b5b35f..a95a9de8ae 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaRegistryClientMessageConverter.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/AvroSchemaRegistryClientMessageConverter.java @@ -138,25 +138,6 @@ public class AvroSchemaRegistryClientMessageConverter extends AbstractAvroMessag private boolean ignoreSchemaRegistryServer; - /** - * Creates a new instance, configuring it with {@link SchemaRegistryClient} and - * {@link CacheManager}. - * - * @param schemaRegistryClient the {@link SchemaRegistryClient} used to interact with - * the schema registry server. - * @param cacheManager instance of {@link CacheManager} to cache parsed schemas. If - * caching is not required use {@link NoOpCacheManager} - */ - @Deprecated - public AvroSchemaRegistryClientMessageConverter( - SchemaRegistryClient schemaRegistryClient, CacheManager cacheManager) { - super(Collections.singletonList(DEFAULT_AVRO_MIME_TYPE), defaultAvroSchemaServiceManager); - Assert.notNull(schemaRegistryClient, "cannot be null"); - Assert.notNull(cacheManager, "'cacheManager' cannot be null"); - this.schemaRegistryClient = schemaRegistryClient; - this.cacheManager = cacheManager; - } - /** * Creates a new instance, configuring it with {@link SchemaRegistryClient} and * {@link CacheManager}. diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java index 3e20fdb6ea..033a8caba3 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java @@ -19,6 +19,8 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -153,17 +155,7 @@ public Object readData(Class targetClass, byte[] payload, Sche @Test public void avroSchemaMessageConverter() { - AvroSchemaMessageConverter converter = new AvroSchemaMessageConverter(); MimeType mimeType = new MimeType("application", "avro"); - assertThat(mimeType).isEqualTo(converter.getSupportedMimeTypes().get(0)); - - AvroSchemaMessageConverter converter2 = new AvroSchemaMessageConverter(mimeType); - assertThat(mimeType).isEqualTo(converter2.getSupportedMimeTypes().get(0)); - - AvroSchemaMessageConverter converter3 = - new AvroSchemaMessageConverter(Lists.newArrayList(mimeType)); - assertThat(mimeType).isEqualTo(converter3.getSupportedMimeTypes().get(0)); - AvroSchemaServiceManager manager = new AvroSchemaServiceManagerImpl(); AvroSchemaMessageConverter converter4 = new AvroSchemaMessageConverter(manager); assertThat(mimeType).isEqualTo(converter4.getSupportedMimeTypes().get(0)); diff --git a/schema-registry/spring-cloud-stream-schema-registry-core/src/main/java/org/springframework/cloud/stream/schema/registry/controllers/ServerController.java b/schema-registry/spring-cloud-stream-schema-registry-core/src/main/java/org/springframework/cloud/stream/schema/registry/controllers/ServerController.java index ebf0d5b32d..579e2f106b 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-core/src/main/java/org/springframework/cloud/stream/schema/registry/controllers/ServerController.java +++ b/schema-registry/spring-cloud-stream-schema-registry-core/src/main/java/org/springframework/cloud/stream/schema/registry/controllers/ServerController.java @@ -132,27 +132,6 @@ public ResponseEntity findOne(@PathVariable("id") Integer id) { return new ResponseEntity<>(schema.get(), HttpStatus.OK); } - /** - *

- * Find by {@link Schema#getSubject() subject} and {@link Schema#getFormat() format}. - * - * @param subject the {@link Schema#getSubject() subject}, must not be - * {@literal null}. - * @param format the {@link Schema#getFormat() format}, must not be {@literal null}. - * @return An {@link HttpStatus#OK} response populated with the list of {@link Schema - * Schemas}, in ascending order by {@link Schema#getVersion() version}, that matched - * the supplied {@link Schema#getSubject() subject} and {@link Schema#getFormat() - * format}. - * @deprecated use {@link #findBySubjectAndFormat(String, String)} - * @see GH-1760 - */ - @Deprecated - public ResponseEntity> findBySubjectAndVersion(@PathVariable("subject") String subject, - @PathVariable("format") String format) { - return findBySubjectAndFormatOrderByVersionAsc(subject, format); - } - /** * Find by {@link Schema#getSubject() subject} and {@link Schema#getFormat() format}. * diff --git a/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java b/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java index 1dc630367e..7bbd30c95b 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java @@ -459,7 +459,7 @@ public void findSchemasBySubjectAndVersion() { assertThat(schemas).hasSize(2); final ResponseEntity> findBySubjectAndVersionResponseEntity = this.serverController - .findBySubjectAndVersion(subject, format); + .findBySubjectAndFormat(subject, format); assertThat(findBySubjectAndVersionResponseEntity.getStatusCode().is2xxSuccessful()).isTrue();