From 370e94342879b5e651a7f6d3787db82c561414a2 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 9 Jan 2020 15:28:50 -0500 Subject: [PATCH] Remove deprecations from previous versions * Remove Boon dependency and its usage * Remove overloaded methods from the `IntegrationFlowDefinition` - we can simply rely now on the super class * Remove (or rework) deprecated entities in the docs * Fix tests for removed deprecated APIs * Rework affected tests to JUnit 5 --- build.gradle | 2 - .../amqp/config/AmqpChannelFactoryBean.java | 12 +- .../amqp/dsl/AmqpMessageChannelSpec.java | 13 +- .../SimpleMessageListenerContainerSpec.java | 13 +- .../aop/MessagePublishingInterceptor.java | 10 +- .../channel/AbstractMessageChannel.java | 5 +- .../channel/ChannelInterceptorAware.java | 50 -- .../ExecutorChannelInterceptorAware.java | 9 +- .../dsl/IntegrationFlowAdapter.java | 40 +- .../dsl/IntegrationFlowDefinition.java | 838 +----------------- .../integration/dsl/IntegrationFlows.java | 70 +- .../gateway/GatewayProxyFactoryBean.java | 19 +- ...ressionEvaluatingRequestHandlerAdvice.java | 24 +- .../store/AbstractKeyValueMessageStore.java | 9 +- .../support/json/BoonJsonObjectMapper.java | 216 ----- .../support/json/JsonObjectMapperAdapter.java | 33 - .../json/JsonObjectMapperProvider.java | 24 +- .../util/DynamicPeriodicTrigger.java | 86 +- .../GatewayProxyMessageMappingTests.java | 14 +- .../dsl/RemoteFileOutboundGatewaySpec.java | 14 +- .../AbstractRegexPatternFileListFilter.java | 16 +- .../http/support/DefaultHttpHeaderMapper.java | 296 +------ .../AbstractByteArraySerializer.java | 11 +- .../integration/jdbc/JdbcMessageHandler.java | 14 +- .../jdbc/JdbcPollingChannelAdapter.java | 14 +- .../integration/jdbc/StoredProcExecutor.java | 24 +- .../jdbc/store/JdbcChannelMessageStore.java | 17 +- .../jdbc/store/JdbcMessageStore.java | 65 +- .../ImapMailInboundChannelAdapterSpec.java | 18 +- .../config/MongoDbOutboundGatewayParser.java | 12 +- .../outbound/MongoDbOutboundGateway.java | 26 +- .../support/MongoDbMessageBytesConverter.java | 83 -- .../config/spring-integration-mongodb.xsd | 2 - ...goDbOutboundGatewayParserTests-context.xml | 2 +- .../MongoDbOutboundGatewayParserTests.java | 36 +- .../core/DefaultMqttPahoClientFactory.java | 102 +-- .../integration/redis/util/RedisUtils.java | 88 -- .../rmi/BackToBackTests-context.xml | 2 +- .../dsl/RSocketOutboundGatewaySpec.java | 54 +- .../outbound/RSocketOutboundGateway.java | 61 +- ...ivingChannelAdapterParserTests-context.xml | 12 +- .../test/matcher/EventuallyMatcher.java | 93 -- .../test/matcher/MapContentMatchers.java | 49 +- .../integration/test/util/SocketUtils.java | 210 ----- src/reference/asciidoc/dsl.adoc | 4 +- src/reference/asciidoc/testing.adoc | 6 +- src/reference/asciidoc/transformer.adoc | 4 - 47 files changed, 134 insertions(+), 2688 deletions(-) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptorAware.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/support/json/BoonJsonObjectMapper.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java delete mode 100644 spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoDbMessageBytesConverter.java delete mode 100644 spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisUtils.java delete mode 100644 spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java delete mode 100644 spring-integration-test-support/src/main/java/org/springframework/integration/test/util/SocketUtils.java diff --git a/build.gradle b/build.gradle index 9761989d54..4a2ecfa3ff 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,6 @@ ext { assertjVersion = '3.14.0' assertkVersion = '0.20' awaitilityVersion = '4.0.1' - boonVersion = '0.34' commonsDbcp2Version = '2.7.0' commonsIoVersion = '2.6' commonsNetVersion = '3.6' @@ -411,7 +410,6 @@ project('spring-integration-core') { api 'io.projectreactor:reactor-core' optionalApi 'com.fasterxml.jackson.core:jackson-databind' optionalApi "com.jayway.jsonpath:json-path:$jsonpathVersion" - optionalApi "io.fastjson:boon:$boonVersion" optionalApi "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" optionalApi "io.micrometer:micrometer-core:$micrometerVersion" optionalApi "io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion" diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java index 86cbd87c2c..0ac46b6c62 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -314,16 +314,6 @@ public class AmqpChannelFactoryBean extends AbstractFactoryBean> extends return _this(); } - /** - * Configure the txSize. - * @param txSize the txSize. - * @return the spec. - * @deprecated since 5.2 in favor of {@link #batchSize(int)} - */ - @Deprecated - public S txSize(int txSize) { - return batchSize(txSize); - } - /** * Configure the batch size. * @param batchSize the batchSize. diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/SimpleMessageListenerContainerSpec.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/SimpleMessageListenerContainerSpec.java index 4fe5cbe384..36994e1b9b 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/SimpleMessageListenerContainerSpec.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/SimpleMessageListenerContainerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2020 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. @@ -107,17 +107,6 @@ public class SimpleMessageListenerContainerSpec extends return this; } - /** - * @param txSize the txSize. - * @return the spec. - * @see SimpleMessageListenerContainer#setBatchSize(int) - * @deprecated since 5.2 in favor of {@link #batchSize(int)} - */ - @Deprecated - public SimpleMessageListenerContainerSpec txSize(int txSize) { - return batchSize(txSize); - } - /** * The batch size to use. * @param batchSize the batchSize. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java index 68adddf216..72a5dd20bc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/MessagePublishingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -79,14 +79,6 @@ public class MessagePublishingInterceptor implements MethodInterceptor, BeanFact this.metadataSource = metadataSource; } - /** - * @param metadataSource the {@link PublisherMetadataSource} to use. - * @deprecated since 5.2 in favor constructor argument. - */ - @Deprecated - public void setPublisherMetadataSource(PublisherMetadataSource metadataSource) { - } - /** * @param defaultChannelName the default channel name. * @since 4.0.3 diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java index e8fc1b1bca..18955d935e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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,6 +51,7 @@ import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageDeliveryException; import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.support.ChannelInterceptor; +import org.springframework.messaging.support.InterceptableChannel; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -68,7 +69,7 @@ import org.springframework.util.StringUtils; @IntegrationManagedResource @SuppressWarnings("deprecation") public abstract class AbstractMessageChannel extends IntegrationObjectSupport - implements MessageChannel, TrackableComponent, ChannelInterceptorAware, + implements MessageChannel, TrackableComponent, InterceptableChannel, org.springframework.integration.support.management.MessageChannelMetrics, ConfigurableMetricsAware, IntegrationPattern { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptorAware.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptorAware.java deleted file mode 100644 index 242313f316..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptorAware.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2014-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.channel; - -import java.util.List; - -import org.springframework.messaging.support.ChannelInterceptor; -import org.springframework.messaging.support.InterceptableChannel; - -/** - * A marker interface providing the ability to configure {@link ChannelInterceptor}s - * on {@link org.springframework.messaging.MessageChannel} implementations. - *

- * Typically useful when the target {@link org.springframework.messaging.MessageChannel} - * is an AOP Proxy. - * * - * @author Artem Bilan - * @author Gary Russell - * - * @since 4.0 - * - * @deprecated since 5.2 in favor of {@link InterceptableChannel}. - * Will be removed in the next 5.3 version. - */ -@Deprecated -public interface ChannelInterceptorAware extends InterceptableChannel { - - /** - * return the {@link ChannelInterceptor} list. - * @return the {@link ChannelInterceptor} list. - */ - default List getChannelInterceptors() { - return getInterceptors(); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ExecutorChannelInterceptorAware.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ExecutorChannelInterceptorAware.java index 29f8a48ef4..bb402c6aa1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ExecutorChannelInterceptorAware.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/ExecutorChannelInterceptorAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2020 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. @@ -16,8 +16,10 @@ package org.springframework.integration.channel; +import org.springframework.messaging.support.InterceptableChannel; + /** - * The {@link ChannelInterceptorAware} extension for the cases when + * The {@link InterceptableChannel} extension for the cases when * the {@link org.springframework.messaging.support.ExecutorChannelInterceptor}s * may have reason (e.g. {@link ExecutorChannel} or {@link QueueChannel}) * and the implementors require to know if they should make the @@ -28,8 +30,7 @@ package org.springframework.integration.channel; * * @since 4.2 */ -@SuppressWarnings("deprecation") -public interface ExecutorChannelInterceptorAware extends ChannelInterceptorAware { +public interface ExecutorChannelInterceptorAware extends InterceptableChannel { boolean hasExecutorInterceptors(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java index 2d521ccb60..66d24c9815 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 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. @@ -179,32 +179,6 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi return IntegrationFlows.from(inboundGatewaySpec); } - /** - * @param service service for polling method - * @param methodName method to poll - * @return the IntegrationFlowBuilder - * @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)} - */ - @Deprecated - protected IntegrationFlowBuilder from(Object service, String methodName) { - return IntegrationFlows.from(service, methodName); - } - - /** - * - * @param service service for polling method - * @param methodName method to poll - * @param endpointConfigurer configurer for {@link SourcePollingChannelAdapterSpec} - * @return the IntegrationFlowBuilder - * @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)} - */ - @Deprecated - protected IntegrationFlowBuilder from(Object service, String methodName, - Consumer endpointConfigurer) { - - return IntegrationFlows.from(service, methodName, endpointConfigurer); - } - protected IntegrationFlowBuilder from(Supplier messageSource) { return IntegrationFlows.from(messageSource); } @@ -219,18 +193,6 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi return IntegrationFlows.from(serviceInterface); } - /** - * Start a flow from a proxy for the service interface. - * @param serviceInterface the service interface to proxy for the gateway. - * @param beanName the bean name for the gateway proxy. - * @return the {@link IntegrationFlowBuilder} instance - * @deprecated since 5.2 in favor of {@link #from(Class, Consumer)} - */ - @Deprecated - protected IntegrationFlowBuilder from(Class serviceInterface, @Nullable String beanName) { - return from(serviceInterface, (gateway) -> gateway.beanName(beanName)); - } - /** * Start a flow from a proxy for the service interface. * @param serviceInterface the service interface class. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java index 2d9f9f266a..346bc31c99 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 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. @@ -16,38 +16,16 @@ package org.springframework.integration.dsl; -import java.util.Map; -import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Function; -import org.reactivestreams.Publisher; - -import org.springframework.expression.Expression; import org.springframework.integration.core.GenericSelector; -import org.springframework.integration.handler.BridgeHandler; import org.springframework.integration.handler.GenericHandler; -import org.springframework.integration.handler.LoggingHandler; -import org.springframework.integration.handler.MessageTriggerAction; import org.springframework.integration.handler.ServiceActivatingHandler; -import org.springframework.integration.router.AbstractMessageRouter; -import org.springframework.integration.router.ErrorMessageExceptionTypeRouter; -import org.springframework.integration.router.ExpressionEvaluatingRouter; import org.springframework.integration.router.MethodInvokingRouter; -import org.springframework.integration.splitter.AbstractMessageSplitter; -import org.springframework.integration.splitter.DefaultMessageSplitter; -import org.springframework.integration.splitter.ExpressionEvaluatingSplitter; import org.springframework.integration.splitter.MethodInvokingSplitter; -import org.springframework.integration.store.MessageStore; -import org.springframework.integration.support.MapBuilder; import org.springframework.integration.transformer.GenericTransformer; -import org.springframework.integration.transformer.HeaderFilter; import org.springframework.integration.transformer.MessageTransformingHandler; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; -import org.springframework.messaging.MessageHandler; - -import reactor.core.publisher.Flux; /** * The {@code BaseIntegrationFlowDefinition} extension for syntax sugar with generics for some @@ -270,818 +248,4 @@ public abstract class IntegrationFlowDefinition messageChannelSpec) { // NOSONAR - byte code backward compatibility - return super.channel(messageChannelSpec); - } - - @Override - public B channel(MessageChannel messageChannel) { // NOSONAR - byte code backward compatibility - return super.channel(messageChannel); - } - - @Override - public B channel(Function> channels) { // NOSONAR - byte code backward compatibility - return super.channel(channels); - } - - @Override - public B publishSubscribeChannel(Consumer publishSubscribeChannelConfigurer) { // NOSONAR - byte code backward compatibility - return super.publishSubscribeChannel(publishSubscribeChannelConfigurer); - } - - @Override - public B publishSubscribeChannel(Executor executor, - Consumer publishSubscribeChannelConfigurer) { // NOSONAR - byte code backward compatibility - - return super.publishSubscribeChannel(executor, publishSubscribeChannelConfigurer); - } - - @Override - public B wireTap(IntegrationFlow flow) { // NOSONAR - byte code backward compatibility - return super.wireTap(flow); - } - - @Override - public B wireTap(String wireTapChannel) { // NOSONAR - byte code backward compatibility - return super.wireTap(wireTapChannel); - } - - @Override - public B wireTap(MessageChannel wireTapChannel) { // NOSONAR - byte code backward compatibility - return super.wireTap(wireTapChannel); - } - - @Override - public B wireTap(IntegrationFlow flow, Consumer wireTapConfigurer) { // NOSONAR - byte code backward compatibility - return super.wireTap(flow, wireTapConfigurer); - } - - @Override - public B wireTap(String wireTapChannel, Consumer wireTapConfigurer) { // NOSONAR - byte code backward compatibility - return super.wireTap(wireTapChannel, wireTapConfigurer); - } - - @Override - public B wireTap(MessageChannel wireTapChannel, Consumer wireTapConfigurer) { // NOSONAR - byte code backward compatibility - return super.wireTap(wireTapChannel, wireTapConfigurer); - } - - @Override - public B wireTap(WireTapSpec wireTapSpec) { // NOSONAR - byte code backward compatibility - return super.wireTap(wireTapSpec); - } - - @Override - public B controlBus() { // NOSONAR - byte code backward compatibility - return super.controlBus(); - } - - @Override - public B controlBus(Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.controlBus(endpointConfigurer); - } - - @Override - public B transform(String expression) { // NOSONAR - byte code backward compatibility - return super.transform(expression); - } - - @Override - public B transform(String expression, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.transform(expression, endpointConfigurer); - } - - @Override - public B transform(Object service) { // NOSONAR - byte code backward compatibility - return super.transform(service); - } - - @Override - public B transform(Object service, String methodName) { // NOSONAR - byte code backward compatibility - return super.transform(service, methodName); - } - - @Override - public B transform(Object service, String methodName, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.transform(service, methodName, endpointConfigurer); - } - - @Override - public B transform(MessageProcessorSpec messageProcessorSpec) { // NOSONAR - byte code backward compatibility - return super.transform(messageProcessorSpec); - } - - @Override - public B transform(MessageProcessorSpec messageProcessorSpec, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.transform(messageProcessorSpec, endpointConfigurer); - } - - @Override - public

B convert(Class

payloadType) { // NOSONAR - byte code backward compatibility - return super.convert(payloadType); - } - - @Override - public B transform(Class

payloadType, GenericTransformer genericTransformer) { // NOSONAR - byte code backward compatibility - return super.transform(payloadType, genericTransformer); - } - - @Override - public

B convert(Class

payloadType, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.convert(payloadType, endpointConfigurer); - } - - @Override - public B transform(Class

payloadType, GenericTransformer genericTransformer, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.transform(payloadType, genericTransformer, endpointConfigurer); - } - - @Override - public B filter(String expression) { // NOSONAR - byte code backward compatibility - return super.filter(expression); - } - - @Override - public B filter(String expression, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.filter(expression, endpointConfigurer); - } - - @Override - public B filter(Object service) { // NOSONAR - byte code backward compatibility - return super.filter(service); - } - - @Override - public B filter(Object service, String methodName) { // NOSONAR - byte code backward compatibility - return super.filter(service, methodName); - } - - @Override - public B filter(Object service, String methodName, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.filter(service, methodName, endpointConfigurer); - } - - @Override - public B filter(MessageProcessorSpec messageProcessorSpec) { // NOSONAR - byte code backward compatibility - return super.filter(messageProcessorSpec); - } - - @Override - public B filter(MessageProcessorSpec messageProcessorSpec, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.filter(messageProcessorSpec, endpointConfigurer); - } - - @Override - public

B filter(Class

payloadType, GenericSelector

genericSelector) { // NOSONAR - byte code backward compatibility - return super.filter(payloadType, genericSelector); - } - - @Override - public

B filter(Class

payloadType, GenericSelector

genericSelector, - Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.filter(payloadType, genericSelector, endpointConfigurer); - } - - @Override - public B handle(MessageHandlerSpec messageHandlerSpec) { // NOSONAR - byte code backward compatibility - return super.handle(messageHandlerSpec); - } - - @Override - public B handle(MessageHandler messageHandler) { // NOSONAR - byte code backward compatibility - return super.handle(messageHandler); - } - - @Override - public B handle(String beanName, String methodName) { // NOSONAR - byte code backward compatibility - return super.handle(beanName, methodName); - } - - @Override - public B handle(String beanName, String methodName, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.handle(beanName, methodName, endpointConfigurer); - } - - @Override - public B handle(Object service) { // NOSONAR - byte code backward compatibility - return super.handle(service); - } - - @Override - public B handle(Object service, String methodName) { // NOSONAR - byte code backward compatibility - return super.handle(service, methodName); - } - - @Override - public B handle(Object service, String methodName, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.handle(service, methodName, endpointConfigurer); - } - - @Override - public

B handle(Class

payloadType, GenericHandler

handler) { // NOSONAR - byte code backward compatibility - return super.handle(payloadType, handler); - } - - @Override - public

B handle(Class

payloadType, GenericHandler

handler, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.handle(payloadType, handler, endpointConfigurer); - } - - @Override - public B handle(MessageProcessorSpec messageProcessorSpec) { // NOSONAR - byte code backward compatibility - return super.handle(messageProcessorSpec); - } - - @Override - public B handle(MessageProcessorSpec messageProcessorSpec, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.handle(messageProcessorSpec, endpointConfigurer); - } - - @Override - public B handle(MessageHandlerSpec messageHandlerSpec, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.handle(messageHandlerSpec, endpointConfigurer); - } - - @Override - public B handle(H messageHandler, Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.handle(messageHandler, endpointConfigurer); - } - - @Override - public B bridge() { // NOSONAR - byte code backward compatibility - return super.bridge(); - } - - @Override - public B bridge(Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.bridge(endpointConfigurer); - } - - @Override - public B delay(String groupId) { // NOSONAR - byte code backward compatibility - return super.delay(groupId); - } - - @Override - public B delay(String groupId, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.delay(groupId, endpointConfigurer); - } - - @Override - public B enrich(Consumer enricherConfigurer) { // NOSONAR - byte code backward compatibility - return super.enrich(enricherConfigurer); - } - - @Override - public B enrichHeaders(MapBuilder headers) { // NOSONAR - byte code backward compatibility - return super.enrichHeaders(headers); - } - - @Override - public B enrichHeaders(MapBuilder headers, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.enrichHeaders(headers, endpointConfigurer); - } - - @Override - public B enrichHeaders(Map headers, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.enrichHeaders(headers, endpointConfigurer); - } - - @Override - public B enrichHeaders(Consumer headerEnricherConfigurer) { // NOSONAR - byte code backward compatibility - return super.enrichHeaders(headerEnricherConfigurer); - } - - @Override - public B split() { // NOSONAR - byte code backward compatibility - return super.split(); - } - - @Override - public B split(Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.split(endpointConfigurer); - } - - @Override - public B split(String expression) { // NOSONAR - byte code backward compatibility - return super.split(expression); - } - - @Override - public B split(String expression, Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.split(expression, endpointConfigurer); - } - - @Override - public B split(Object service) { // NOSONAR - byte code backward compatibility - return super.split(service); - } - - @Override - public B split(Object service, String methodName) { // NOSONAR - byte code backward compatibility - return super.split(service, methodName); - } - - @Override - public B split(Object service, String methodName, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.split(service, methodName, endpointConfigurer); - } - - @Override - public B split(String beanName, String methodName) { // NOSONAR - byte code backward compatibility - return super.split(beanName, methodName); - } - - @Override - public B split(String beanName, String methodName, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.split(beanName, methodName, endpointConfigurer); - } - - @Override - public B split(MessageProcessorSpec messageProcessorSpec) { // NOSONAR - byte code backward compatibility - return super.split(messageProcessorSpec); - } - - @Override - public B split(MessageProcessorSpec messageProcessorSpec, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.split(messageProcessorSpec, endpointConfigurer); - } - - @Override - public

B split(Class

payloadType, Function splitter) { // NOSONAR - byte code backward compatibility - return super.split(payloadType, splitter); - } - - @Override - public

B split(Class

payloadType, Function splitter, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.split(payloadType, splitter, endpointConfigurer); - } - - @Override - public B split(MessageHandlerSpec splitterMessageHandlerSpec) { // NOSONAR - byte code backward compatibility - return super.split(splitterMessageHandlerSpec); - } - - @Override - public B split(MessageHandlerSpec splitterMessageHandlerSpec, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.split(splitterMessageHandlerSpec, endpointConfigurer); - } - - @Override - public B split(AbstractMessageSplitter splitter) { // NOSONAR - byte code backward compatibility - return super.split(splitter); - } - - @Override - public B split(S splitter, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.split(splitter, endpointConfigurer); - } - - @Override - public B headerFilter(String... headersToRemove) { // NOSONAR - byte code backward compatibility - return super.headerFilter(headersToRemove); - } - - @Override - public B headerFilter(String headersToRemove, boolean patternMatch) { // NOSONAR - byte code backward compatibility - return super.headerFilter(headersToRemove, patternMatch); - } - - @Override - public B headerFilter(HeaderFilter headerFilter, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.headerFilter(headerFilter, endpointConfigurer); - } - - @Override - public B claimCheckIn(MessageStore messageStore) { // NOSONAR - byte code backward compatibility - return super.claimCheckIn(messageStore); - } - - @Override - public B claimCheckIn(MessageStore messageStore, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.claimCheckIn(messageStore, endpointConfigurer); - } - - @Override - public B claimCheckOut(MessageStore messageStore) { // NOSONAR - byte code backward compatibility - return super.claimCheckOut(messageStore); - } - - @Override - public B claimCheckOut(MessageStore messageStore, boolean removeMessage) { // NOSONAR - byte code backward compatibility - return super.claimCheckOut(messageStore, removeMessage); - } - - @Override - public B claimCheckOut(MessageStore messageStore, boolean removeMessage, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.claimCheckOut(messageStore, removeMessage, endpointConfigurer); - } - - @Override - public B resequence() { // NOSONAR - byte code backward compatibility - return super.resequence(); - } - - @Override - public B resequence(Consumer resequencer) { // NOSONAR - byte code backward compatibility - return super.resequence(resequencer); - } - - @Override - public B aggregate() { // NOSONAR - byte code backward compatibility - return super.aggregate(); - } - - @Override - public B aggregate(Consumer aggregator) { // NOSONAR - byte code backward compatibility - return super.aggregate(aggregator); - } - - @Override - public B route(String beanName, String method) { // NOSONAR - byte code backward compatibility - return super.route(beanName, method); - } - - @Override - public B route(String beanName, String method, - Consumer> routerConfigurer) { // NOSONAR - byte code backward compatibility - - return super.route(beanName, method, routerConfigurer); - } - - @Override - public B route(Object service) { // NOSONAR - byte code backward compatibility - return super.route(service); - } - - @Override - public B route(Object service, String methodName) { // NOSONAR - byte code backward compatibility - return super.route(service, methodName); - } - - @Override - public B route(Object service, String methodName, - Consumer> routerConfigurer) { // NOSONAR - byte code backward compatibility - - return super.route(service, methodName, routerConfigurer); - } - - @Override - public B route(String expression) { // NOSONAR - byte code backward compatibility - return super.route(expression); - } - - @Override - public B route(String expression, Consumer> routerConfigurer) { // NOSONAR - byte code backward compatibility - return super.route(expression, routerConfigurer); - } - - @Override - public B route(Class payloadType, Function router) { // NOSONAR - byte code backward compatibility - return super.route(payloadType, router); - } - - @Override - public B route(Class

payloadType, Function router, - Consumer> routerConfigurer) { // NOSONAR - byte code backward compatibility - return super.route(payloadType, router, routerConfigurer); - } - - @Override - public B route(MessageProcessorSpec messageProcessorSpec) { // NOSONAR - byte code backward compatibility - return super.route(messageProcessorSpec); - } - - @Override - public B route(MessageProcessorSpec messageProcessorSpec, - Consumer> routerConfigurer) { // NOSONAR - byte code backward compatibility - - return super.route(messageProcessorSpec, routerConfigurer); - } - - @Override - public B routeToRecipients(Consumer routerConfigurer) { // NOSONAR - byte code backward compatibility - return super.routeToRecipients(routerConfigurer); - } - - @Override - public B routeByException(Consumer, // NOSONAR - byte code backward compatibility - ErrorMessageExceptionTypeRouter>> routerConfigurer) { - - return super.routeByException(routerConfigurer); - } - - @Override - public B route(AbstractMessageRouter router) { // NOSONAR - byte code backward compatibility - return super.route(router); - } - - @Override - public B route(R router, Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.route(router, endpointConfigurer); - } - - @Override - public B gateway(String requestChannel) { // NOSONAR - byte code backward compatibility - return super.gateway(requestChannel); - } - - @Override - public B gateway(String requestChannel, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.gateway(requestChannel, endpointConfigurer); - } - - @Override - public B gateway(MessageChannel requestChannel) { // NOSONAR - byte code backward compatibility - return super.gateway(requestChannel); - } - - @Override - public B gateway(MessageChannel requestChannel, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.gateway(requestChannel, endpointConfigurer); - } - - @Override - public B gateway(IntegrationFlow flow) { // NOSONAR - byte code backward compatibility - return super.gateway(flow); - } - - @Override - public B gateway(IntegrationFlow flow, Consumer endpointConfigurer) { // NOSONAR - byte code backward compatibility - return super.gateway(flow, endpointConfigurer); - } - - @Override - public B log() { // NOSONAR - byte code backward compatibility - return super.log(); - } - - @Override - public B log(LoggingHandler.Level level) { // NOSONAR - byte code backward compatibility - return super.log(level); - } - - @Override - public B log(String category) { // NOSONAR - byte code backward compatibility - return super.log(category); - } - - @Override - public B log(LoggingHandler.Level level, String category) { // NOSONAR - byte code backward compatibility - return super.log(level, category); - } - - @Override - public B log(LoggingHandler.Level level, String category, String logExpression) { // NOSONAR - byte code backward compatibility - return super.log(level, category, logExpression); - } - - @Override - public

B log(Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.log(function); - } - - @Override - public B log(Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.log(logExpression); - } - - @Override - public B log(LoggingHandler.Level level, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.log(level, logExpression); - } - - @Override - public B log(String category, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.log(category, logExpression); - } - - @Override - public

B log(LoggingHandler.Level level, Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.log(level, function); - } - - @Override - public

B log(String category, Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.log(category, function); - } - - @Override - public

B log(LoggingHandler.Level level, String category, Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.log(level, category, function); - } - - @Override - public B log(LoggingHandler.Level level, String category, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.log(level, category, logExpression); - } - - @Override - public IntegrationFlow logAndReply() { // NOSONAR - byte code backward compatibility - return super.logAndReply(); - } - - @Override - public IntegrationFlow logAndReply(LoggingHandler.Level level) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level); - } - - @Override - public IntegrationFlow logAndReply(String category) { // NOSONAR - byte code backward compatibility - return super.logAndReply(category); - } - - @Override - public IntegrationFlow logAndReply(LoggingHandler.Level level, String category) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level, category); - } - - @Override - public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, String logExpression) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level, category, logExpression); - } - - @Override - public

IntegrationFlow logAndReply(Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.logAndReply(function); - } - - @Override - public IntegrationFlow logAndReply(Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.logAndReply(logExpression); - } - - @Override - public IntegrationFlow logAndReply(LoggingHandler.Level level, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level, logExpression); - } - - @Override - public IntegrationFlow logAndReply(String category, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.logAndReply(category, logExpression); - } - - @Override - public

IntegrationFlow logAndReply(LoggingHandler.Level level, Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level, function); - } - - @Override - public

IntegrationFlow logAndReply(String category, Function, Object> function) { // NOSONAR - byte code backward compatibility - return super.logAndReply(category, function); - } - - @Override - public

IntegrationFlow logAndReply(LoggingHandler.Level level, String category, - Function, Object> function) { // NOSONAR - byte code backward compatibility - - return super.logAndReply(level, category, function); - } - - @Override - public IntegrationFlow logAndReply(LoggingHandler.Level level, String category, Expression logExpression) { // NOSONAR - byte code backward compatibility - return super.logAndReply(level, category, logExpression); - } - - @Override - public B scatterGather(MessageChannel scatterChannel) { // NOSONAR - byte code backward compatibility - return super.scatterGather(scatterChannel); - } - - @Override - public B scatterGather(MessageChannel scatterChannel, Consumer gatherer) { // NOSONAR - byte code backward compatibility - return super.scatterGather(scatterChannel, gatherer); - } - - @Override - public B scatterGather(MessageChannel scatterChannel, Consumer gatherer, - Consumer scatterGather) { // NOSONAR - byte code backward compatibility - - return super.scatterGather(scatterChannel, gatherer, scatterGather); - } - - @Override - public B scatterGather(Consumer scatterer) { // NOSONAR - byte code backward compatibility - return super.scatterGather(scatterer); - } - - @Override - public B scatterGather(Consumer scatterer, Consumer gatherer) { // NOSONAR - byte code backward compatibility - return super.scatterGather(scatterer, gatherer); - } - - @Override - public B scatterGather(Consumer scatterer, Consumer gatherer, - Consumer scatterGather) { // NOSONAR - byte code backward compatibility - - return super.scatterGather(scatterer, gatherer, scatterGather); - } - - @Override - public B barrier(long timeout) { // NOSONAR - byte code backward compatibility - return super.barrier(timeout); - } - - @Override - public B barrier(long timeout, Consumer barrierConfigurer) { // NOSONAR - byte code backward compatibility - return super.barrier(timeout, barrierConfigurer); - } - - @Override - public B trigger(String triggerActionId) { // NOSONAR - byte code backward compatibility - return super.trigger(triggerActionId); - } - - @Override - public B trigger(String triggerActionId, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.trigger(triggerActionId, endpointConfigurer); - } - - @Override - public B trigger(MessageTriggerAction triggerAction) { // NOSONAR - byte code backward compatibility - return super.trigger(triggerAction); - } - - @Override - public B trigger(MessageTriggerAction triggerAction, - Consumer> endpointConfigurer) { // NOSONAR - byte code backward compatibility - - return super.trigger(triggerAction, endpointConfigurer); - } - - @Override - public B fluxTransform(Function>, ? extends Publisher> fluxFunction) { // NOSONAR - byte code backward compatibility - return super.fluxTransform(fluxFunction); - } - - @Override - public IntegrationFlow nullChannel() { // NOSONAR - byte code backward compatibility - return super.nullChannel(); - } - - @Override - public B enrichHeaders(Map headers) { // NOSONAR - byte code backward compatibility - return super.enrichHeaders(headers); - } - } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java index c4aed573ca..ec1b260c45 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 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. @@ -113,7 +113,7 @@ public final class IntegrationFlows { * @see MessageSourceSpec and its implementations. */ public static IntegrationFlowBuilder from(MessageSourceSpec> messageSourceSpec) { - return from(messageSourceSpec, (Consumer) null); + return from(messageSourceSpec, null); } /** @@ -133,20 +133,6 @@ public final class IntegrationFlows { return from(messageSourceSpec.get(), endpointConfigurer, registerComponents(messageSourceSpec)); } - /** - * Populate the provided {@link MethodInvokingMessageSource} for the method of the provided service. - * The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}. - * @param service the service to use. - * @param methodName the method to invoke. - * @return new {@link IntegrationFlowBuilder}. - * @see MethodInvokingMessageSource - * @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)} - */ - @Deprecated - public static IntegrationFlowBuilder from(Object service, String methodName) { - return from(service, methodName, null); - } - /** * Provides {@link Supplier} as source of messages to the integration flow which will * be triggered by the application context's default poller (which must be declared). @@ -156,7 +142,7 @@ public final class IntegrationFlows { * @see Supplier */ public static IntegrationFlowBuilder from(Supplier messageSource) { - return from(messageSource, (Consumer) null); + return from(messageSource, null); } /** @@ -172,6 +158,7 @@ public final class IntegrationFlows { */ public static IntegrationFlowBuilder from(Supplier messageSource, Consumer endpointConfigurer) { + Assert.notNull(messageSource, "'messageSource' must not be null"); MethodInvokingMessageSource methodInvokingMessageSource = new MethodInvokingMessageSource(); methodInvokingMessageSource.setObject(messageSource); @@ -179,28 +166,6 @@ public final class IntegrationFlows { return from(methodInvokingMessageSource, endpointConfigurer); } - /** - * Populate the provided {@link MethodInvokingMessageSource} for the method of the provided service. - * The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}. - * @param service the service to use. - * @param methodName the method to invoke. - * @param endpointConfigurer the {@link Consumer} to provide more options for the - * {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}. - * @return new {@link IntegrationFlowBuilder}. - * @see MethodInvokingMessageSource - * @deprecated since 5.2 in favor of method reference via {@link #from(Supplier)} - */ - @Deprecated - public static IntegrationFlowBuilder from(Object service, String methodName, - Consumer endpointConfigurer) { - Assert.notNull(service, "'service' must not be null"); - Assert.hasText(methodName, "'methodName' must not be empty"); - MethodInvokingMessageSource messageSource = new MethodInvokingMessageSource(); - messageSource.setObject(service); - messageSource.setMethodName(methodName); - return from(messageSource, endpointConfigurer); - } - /** * Populate the provided {@link MessageSource} object to the {@link IntegrationFlowBuilder} chain. * The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}. @@ -209,7 +174,7 @@ public final class IntegrationFlows { * @see MessageSource */ public static IntegrationFlowBuilder from(MessageSource messageSource) { - return from(messageSource, (Consumer) null); + return from(messageSource, null); } /** @@ -265,7 +230,7 @@ public final class IntegrationFlows { * @return new {@link IntegrationFlowBuilder}. */ public static IntegrationFlowBuilder from(MessageProducerSupport messageProducer) { - return from(messageProducer, (IntegrationFlowBuilder) null); + return from(messageProducer, null); } private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, @@ -304,7 +269,7 @@ public final class IntegrationFlows { * @return new {@link IntegrationFlowBuilder}. */ public static IntegrationFlowBuilder from(MessagingGatewaySupport inboundGateway) { - return from(inboundGateway, (IntegrationFlowBuilder) null); + return from(inboundGateway, null); } /** @@ -320,26 +285,7 @@ public final class IntegrationFlows { * @return new {@link IntegrationFlowBuilder}. */ public static IntegrationFlowBuilder from(Class serviceInterface) { - return from(serviceInterface, (Consumer) null); - } - - /** - * Populate the {@link MessageChannel} to the new {@link IntegrationFlowBuilder} - * chain, which becomes as a {@code requestChannel} for the Messaging Gateway(s) built - * on the provided service interface. - *

A gateway proxy bean for provided service interface is registered under a name of - * the provided {@code beanName} if not null, or from the - * {@link org.springframework.integration.annotation.MessagingGateway#name()} if present - * or as a fallback to the {@link IntegrationFlow} bean name plus {@code .gateway} suffix. - * @param serviceInterface the service interface class with an optional - * {@link org.springframework.integration.annotation.MessagingGateway} annotation. - * @param beanName the bean name to be used for registering bean for the gateway proxy - * @return new {@link IntegrationFlowBuilder}. - * @deprecated since 5.2 in favor of {@link #from(Class, Consumer)} - */ - @Deprecated - public static IntegrationFlowBuilder from(Class serviceInterface, @Nullable String beanName) { - return from(serviceInterface, gateway -> gateway.beanName(beanName)); + return from(serviceInterface, null); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java index 6e996a597e..88c846fc67 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -109,7 +109,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint private final Map gatewayMap = new HashMap<>(); - private Class serviceInterface = RequestReplyExchanger.class; + private final Class serviceInterface; private MessageChannel defaultRequestChannel; @@ -161,6 +161,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint * {@link RequestReplyExchanger}, upon initialization. */ public GatewayProxyFactoryBean() { + this.serviceInterface = RequestReplyExchanger.class; } public GatewayProxyFactoryBean(Class serviceInterface) { @@ -169,20 +170,6 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint this.serviceInterface = serviceInterface; } - - /** - * Set the interface class that the generated proxy should implement. - * If none is provided explicitly, the default is {@link RequestReplyExchanger}. - * @param serviceInterface The service interface. - * @deprecated since 5.2.1 in favor of ctor initialization - */ - @Deprecated - public void setServiceInterface(Class serviceInterface) { - Assert.notNull(serviceInterface, "'serviceInterface' must not be null"); - Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface"); - this.serviceInterface = serviceInterface; - } - /** * Set the default request channel. * @param defaultRequestChannel the channel to which request messages will diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java index d5f3305201..525b3987fb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/ExpressionEvaluatingRequestHandlerAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -98,17 +98,6 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan this.onSuccessExpression = onSuccessExpression; } - /** - * Set the expression to evaluate against the message after a successful - * handler invocation. - * @param onSuccessExpression the SpEL expression. - * @deprecated in favor of {@link #setOnSuccessExpression(Expression)} - */ - @Deprecated - public void setExpressionOnSuccess(Expression onSuccessExpression) { - setOnSuccessExpression(onSuccessExpression); - } - /** * Set the expression to evaluate against the root message after a failed * handler invocation. The exception is available as the variable {@code #exception}. @@ -131,17 +120,6 @@ public class ExpressionEvaluatingRequestHandlerAdvice extends AbstractRequestHan this.onFailureExpression = onFailureExpression; } - /** - * Set the expression to evaluate against the root message after a failed - * handler invocation. The exception is available as the variable {@code #exception} - * @param onFailureExpression the SpEL expression. - * @deprecated in favor of {@link #setOnFailureExpression(Expression)} - */ - @Deprecated - public void setExpressionOnFailure(Expression onFailureExpression) { - setOnFailureExpression(onFailureExpression); - } - /** * Set the channel to which to send the {@link AdviceMessage} after evaluating the * success expression. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java index d7f8aa0c2f..93f931a415 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -46,13 +46,6 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS protected static final String MESSAGE_GROUP_KEY_PREFIX = "MESSAGE_GROUP_"; - /** - * Represents the time when the message has been added to the store. - * @deprecated since 5.0. This constant isn't used any more. - */ - @Deprecated - protected static final String CREATED_DATE = "CREATED_DATE"; - private final String messagePrefix; private final String groupPrefix; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/BoonJsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/BoonJsonObjectMapper.java deleted file mode 100644 index 05ad32229b..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/BoonJsonObjectMapper.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2014-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.support.json; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.PipedReader; -import java.io.PipedWriter; -import java.io.Reader; -import java.io.Writer; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.Executors; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.boon.json.JsonFactory; -import org.boon.json.JsonParserAndMapper; -import org.boon.json.JsonParserFactory; -import org.boon.json.JsonSerializerFactory; -import org.boon.json.JsonSlurper; -import org.boon.json.ObjectMapper; - -import org.springframework.beans.factory.BeanClassLoaderAware; -import org.springframework.integration.mapping.support.JsonHeaders; -import org.springframework.util.ClassUtils; - -/** - * The Boon (@link https://github.com/RichardHightower/boon) {@link JsonObjectMapper} implementation. - * - * @author Artem Bilan - * @since 4.1 - * - * @deprecated since 5.2. Will be removed in the next version. - */ -@Deprecated -public class BoonJsonObjectMapper implements JsonObjectMapper, Object>, BeanClassLoaderAware { - - private static final Log logger = LogFactory.getLog(BoonJsonObjectMapper.class); - - private static final Collection> supportedJsonTypes = - Arrays.asList(String.class, byte[].class, byte[].class, File.class, InputStream.class, Reader.class); - - - private final ObjectMapper objectMapper; - - private final JsonSlurper slurper = new JsonSlurper(); - - private volatile ClassLoader classLoader = ClassUtils.getDefaultClassLoader(); - - public BoonJsonObjectMapper() { - this.objectMapper = JsonFactory.create(); - } - - public BoonJsonObjectMapper(JsonParserFactory parserFactory, JsonSerializerFactory serializerFactory) { - this.objectMapper = JsonFactory.create(parserFactory, serializerFactory); - } - - @Override - public void setBeanClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - @Override - public String toJson(Object value) { - return this.objectMapper.writeValueAsString(value); - } - - @Override - public void toJson(Object value, Writer writer) { - this.objectMapper.toJson(value, writer); - } - - @Override - @SuppressWarnings("unchecked") - public Map toJsonNode(final Object value) throws IOException { - PipedReader in = new PipedReader(); - final PipedWriter out = new PipedWriter(in); - Executors.newSingleThreadExecutor().execute(() -> toJson(value, out)); - return (Map) this.slurper.parse(in); - } - - @Override - public T fromJson(Object json, Class type) { - if (json instanceof String) { - return this.objectMapper.readValue((String) json, type); - } - else if (json instanceof byte[]) { - return this.objectMapper.readValue((byte[]) json, type); - } - else if (json instanceof char[]) { - return this.objectMapper.readValue((char[]) json, type); - } - else if (json instanceof File) { - return this.objectMapper.readValue((File) json, type); - } - else if (json instanceof InputStream) { - return this.objectMapper.readValue((InputStream) json, type); - } - else if (json instanceof Reader) { - return this.objectMapper.readValue((Reader) json, type); - } - else { - throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes - + " , but gotten: " + json.getClass()); - } - } - - @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public T fromJson(Object json, Map javaTypes) throws IOException { - JsonParserAndMapper parser = this.objectMapper.parser(); - - Class classType = createJavaType(javaTypes, JsonHeaders.TYPE_ID); - - Class contentClassType = createJavaType(javaTypes, JsonHeaders.CONTENT_TYPE_ID); - - Class keyClassType = createJavaType(javaTypes, JsonHeaders.KEY_TYPE_ID); - - if (keyClassType != null) { - logger.warn("Boon doesn't support the Map 'key' conversion. Will be returned raw Map"); - if (json instanceof String) { - return (T) parser.parseMap((String) json); - } - else if (json instanceof byte[]) { - return (T) parser.parseMap((byte[]) json); - } - else if (json instanceof char[]) { - return (T) parser.parseMap((char[]) json); - } - else if (json instanceof File) { - return (T) parser.parseMap(new FileReader((File) json)); - } - else if (json instanceof InputStream) { - return (T) parser.parseMap((InputStream) json); - } - else if (json instanceof Reader) { - return (T) parser.parseMap((Reader) json); - } - else { - throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes - + " , but gotten: " + json.getClass()); - } - } - - if (contentClassType != null) { - if (json instanceof String) { - return (T) this.objectMapper.readValue((String) json, (Class) classType, contentClassType); - } - else if (json instanceof byte[]) { - return (T) this.objectMapper.readValue((byte[]) json, (Class) classType, contentClassType); - } - else if (json instanceof char[]) { - return (T) this.objectMapper.readValue((char[]) json, (Class) classType, contentClassType); - } - else if (json instanceof File) { - return (T) this.objectMapper.readValue((File) json, (Class) classType, contentClassType); - } - else if (json instanceof InputStream) { - return (T) this.objectMapper.readValue((InputStream) json, (Class) classType, - contentClassType); - } - else if (json instanceof Reader) { - return (T) this.objectMapper.readValue((Reader) json, (Class) classType, contentClassType); - } - else { - throw new IllegalArgumentException("'json' argument must be an instance of: " + supportedJsonTypes - + " , but gotten: " + json.getClass()); - } - } - - return (T) fromJson(json, classType); - } - - protected Class createJavaType(Map javaTypes, String javaTypeKey) { - Object classValue = javaTypes.get(javaTypeKey); - if (classValue instanceof Class) { - return (Class) classValue; - } - else if (classValue != null) { - try { - return ClassUtils.forName(classValue.toString(), this.classLoader); - } - catch (ClassNotFoundException | LinkageError e) { - throw new IllegalStateException(e); - } - } - else { - return null; - } - } - - @Override - public T fromJson(Object parser, Type valueType) { - throw new UnsupportedOperationException("Boon doesn't support JSON reader parser abstraction"); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java deleted file mode 100644 index e31f36e1ab..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2013-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.support.json; - -/** - * Simple {@linkplain JsonObjectMapper} adapter implementation, if there is no need - * to provide entire operations implementation. - * - * @author Artem Bilan - * @author Gary Russell - * - * @since 3.0 - * - * @deprecated since 5.2 in favor of {@code default} methods in the {@link JsonObjectMapper} interface - */ -@Deprecated -public abstract class JsonObjectMapperAdapter implements JsonObjectMapper { - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java index a2de31616d..569f3d0b14 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -16,29 +16,21 @@ package org.springframework.integration.support.json; - -import org.springframework.util.ClassUtils; - /** * Simple factory to provide {@linkplain JsonObjectMapper} - * instances dependently of jackson-databind or boon libs in the classpath. - * If there are both libs in the classpath, it prefers Jackson 2 JSON-processor implementation. - * If there is not any of them, {@linkplain IllegalStateException} will be thrown. + * instances based on jackson-databind lib in the classpath. + * If there is no JSON processor in classpath, {@linkplain IllegalStateException} will be thrown. * * @author Artem Bilan * @author Gary Russell * @author Vikas Prasad + * * @since 3.0 * * @see Jackson2JsonObjectMapper */ public final class JsonObjectMapperProvider { - private static final ClassLoader classLoader = JsonObjectMapperProvider.class.getClassLoader(); - - private static final boolean boonPresent = - ClassUtils.isPresent("org.boon.json.ObjectMapper", classLoader); - private JsonObjectMapperProvider() { } @@ -47,16 +39,12 @@ public final class JsonObjectMapperProvider { * @return the mapper. * @throws IllegalStateException if an implementation is not available. */ - @SuppressWarnings("deprecation") public static JsonObjectMapper newInstance() { if (JacksonPresent.isJackson2Present()) { return new Jackson2JsonObjectMapper(); } - else if (boonPresent) { - return new org.springframework.integration.support.json.BoonJsonObjectMapper(); - } else { - throw new IllegalStateException("Neither jackson-databind.jar, nor boon.jar is present in the classpath."); + throw new IllegalStateException("No jackson-databind.jar is present in the classpath."); } } @@ -66,7 +54,7 @@ public final class JsonObjectMapperProvider { * @since 4.2.7 */ public static boolean jsonAvailable() { - return JacksonPresent.isJackson2Present() || boonPresent; + return JacksonPresent.isJackson2Present(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/DynamicPeriodicTrigger.java b/spring-integration-core/src/main/java/org/springframework/integration/util/DynamicPeriodicTrigger.java index 12dc3c246d..ed5afe906b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/DynamicPeriodicTrigger.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/DynamicPeriodicTrigger.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -57,23 +57,6 @@ public class DynamicPeriodicTrigger implements Trigger { this(Duration.ofMillis(period)); } - /** - * Create a trigger with the given period and time unit. The time unit will - * apply not only to the period but also to any 'initialDelay' value, if - * configured on this Trigger later via {@link #setInitialDelay(long)}. - * @param period Must not be negative - * @param timeUnit Must not be null - * @deprecated in favor of {@link #DynamicPeriodicTrigger(Duration)}. - */ - @Deprecated - public DynamicPeriodicTrigger(long period, TimeUnit timeUnit) { - Assert.isTrue(period >= 0, "period must not be negative"); - Assert.notNull(timeUnit, "timeUnit must not be null"); - - this.timeUnit = timeUnit; - this.duration = Duration.ofMillis(this.timeUnit.toMillis(period)); - } - /** * Create a trigger with the provided duration. * @param duration the duration. @@ -85,19 +68,6 @@ public class DynamicPeriodicTrigger implements Trigger { this.duration = duration; } - /** - * Specify the delay for the initial execution. It will be evaluated in - * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly - * provided upon instantiation, the default is milliseconds. - * @param initialDelay the initial delay in milliseconds. - * @deprecated in favor of {@link #setInitialDuration(Duration)}. - */ - @Deprecated - public void setInitialDelay(long initialDelay) { - Assert.isTrue(initialDelay >= 0, "initialDelay must not be negative"); - this.initialDuration = Duration.ofMillis(this.timeUnit.toMillis(initialDelay)); - } - /** * Specify the delay for the initial execution. It will be evaluated in * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly @@ -148,60 +118,6 @@ public class DynamicPeriodicTrigger implements Trigger { this.fixedRate = fixedRate; } - /** - * Return the period in milliseconds. - * @return the period. - * @deprecated in favor of {@link #getDuration()}. - */ - @Deprecated - public long getPeriod() { - return this.duration.toMillis(); - } - - /** - * Specify the period of the trigger. It will be evaluated in - * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly - * provided upon instantiation, the default is milliseconds. - * @param period Must not be negative - * @deprecated in favor of {@link #setDuration(Duration)}. - */ - @Deprecated - public void setPeriod(long period) { - Assert.isTrue(period >= 0, "period must not be negative"); - this.duration = Duration.ofMillis(this.timeUnit.toMillis(period)); - } - - /** - * Get the time unit. - * @return the time unit. - * @deprecated - use {@link Duration} instead. - */ - @Deprecated - public TimeUnit getTimeUnit() { - return this.timeUnit; - } - - /** - * Set the time unit. - * @param timeUnit the time unit. - * @deprecated - use {@link Duration} instead. - */ - @Deprecated - public void setTimeUnit(TimeUnit timeUnit) { - Assert.notNull(timeUnit, "timeUnit must not be null"); - this.timeUnit = timeUnit; - } - - /** - * Get the initial delay in milliseconds. - * @return the initial delay. - * @deprecated in favor of {@link #getInitialDuration()}. - */ - @Deprecated - public long getInitialDelay() { - return this.initialDuration.toMillis(); - } - /** * Return whether this trigger is fixed rate. * @return the fixed rate. diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyMessageMappingTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyMessageMappingTests.java index f29d4c7811..0044bdb5d2 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyMessageMappingTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyMessageMappingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -22,8 +22,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; @@ -49,8 +49,7 @@ public class GatewayProxyMessageMappingTests { private volatile TestGateway gateway = null; - - @Before + @BeforeEach public void initializeGateway() { GatewayProxyFactoryBean factoryBean = new GatewayProxyFactoryBean(TestGateway.class); factoryBean.setDefaultRequestChannel(channel); @@ -64,7 +63,6 @@ public class GatewayProxyMessageMappingTests { this.gateway = (TestGateway) factoryBean.getObject(); } - @Test public void payloadAndHeaderMapWithoutAnnotations() { Map m = new HashMap<>(); @@ -141,7 +139,7 @@ public class GatewayProxyMessageMappingTests { GenericApplicationContext context = new GenericApplicationContext(); RootBeanDefinition gatewayDefinition = new RootBeanDefinition(GatewayProxyFactoryBean.class); gatewayDefinition.getPropertyValues().add("defaultRequestChannel", channel); - gatewayDefinition.getPropertyValues().add("serviceInterface", TestGateway.class); + gatewayDefinition.getConstructorArgumentValues().addGenericArgumentValue(TestGateway.class); context.registerBeanDefinition("testGateway", gatewayDefinition); context.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class)); context.registerBeanDefinition(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME, @@ -168,7 +166,7 @@ public class GatewayProxyMessageMappingTests { GenericApplicationContext context = new GenericApplicationContext(); RootBeanDefinition gatewayDefinition = new RootBeanDefinition(GatewayProxyFactoryBean.class); gatewayDefinition.getPropertyValues().add("defaultRequestChannel", channel); - gatewayDefinition.getPropertyValues().add("serviceInterface", TestGateway.class); + gatewayDefinition.getConstructorArgumentValues().addGenericArgumentValue(TestGateway.class); context.registerBeanDefinition("testGateway", gatewayDefinition); context.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class)); context.registerBeanDefinition(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME, diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java index e031792da7..63b769879f 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 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. @@ -309,18 +309,6 @@ public abstract class RemoteFileOutboundGatewaySpec the expected payload type. - * @return the Spec. - * @deprecated since 5.2 in favor of {@link #localFilenameFunction(Function)} - */ - @Deprecated - public

S localFilename(Function, String> localFilenameFunction) { - return localFilenameFunction(localFilenameFunction); - } - /** * Specify a {@link Function} for local files renaming after downloading. * @param localFilenameFunction the {@link Function} to use. diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractRegexPatternFileListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractRegexPatternFileListFilter.java index fd9fe3a379..19a99ae4ed 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractRegexPatternFileListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractRegexPatternFileListFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -18,7 +18,6 @@ package org.springframework.integration.file.filters; import java.util.regex.Pattern; -import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; /** @@ -33,8 +32,7 @@ import org.springframework.util.Assert; * * @since 2.0 */ -public abstract class AbstractRegexPatternFileListFilter extends AbstractDirectoryAwareFileListFilter - implements InitializingBean { // TODO Remove in the next version +public abstract class AbstractRegexPatternFileListFilter extends AbstractDirectoryAwareFileListFilter { private Pattern pattern; @@ -59,15 +57,6 @@ public abstract class AbstractRegexPatternFileListFilter extends AbstractDire this.pattern = pattern; } - /** - * @deprecated since 5.1.3. Will be removed in the next 5.2 version. - */ - @Override - @Deprecated - public void afterPropertiesSet() { - - } - @Override public boolean accept(F file) { return alwaysAccept(file) || (file != null && this.pattern.matcher(getFilename(file)).matches()); @@ -75,7 +64,6 @@ public abstract class AbstractRegexPatternFileListFilter extends AbstractDire /** * Subclasses must implement this method to extract the file's name. - * * @param file The file. * @return The file name. */ diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java index de7e361a7d..af2b51568d 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -78,300 +78,6 @@ public class DefaultHttpHeaderMapper implements HeaderMapper, BeanF protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR - final - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT} - */ - @Deprecated - public static final String ACCEPT = HttpHeaders.ACCEPT; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_CHARSET} - */ - @Deprecated - public static final String ACCEPT_CHARSET = HttpHeaders.ACCEPT_CHARSET; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_ENCODING} - */ - @Deprecated - public static final String ACCEPT_ENCODING = HttpHeaders.ACCEPT_ENCODING; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_LANGUAGE} - */ - @Deprecated - public static final String ACCEPT_LANGUAGE = HttpHeaders.ACCEPT_LANGUAGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ACCEPT_RANGES} - */ - @Deprecated - public static final String ACCEPT_RANGES = HttpHeaders.ACCEPT_RANGES; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#AGE} - */ - @Deprecated - public static final String AGE = HttpHeaders.AGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ALLOW} - */ - @Deprecated - public static final String ALLOW = HttpHeaders.ALLOW; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#AUTHORIZATION} - */ - @Deprecated - public static final String AUTHORIZATION = HttpHeaders.AUTHORIZATION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CACHE_CONTROL} - */ - @Deprecated - public static final String CACHE_CONTROL = HttpHeaders.CACHE_CONTROL; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONNECTION} - */ - @Deprecated - public static final String CONNECTION = HttpHeaders.CONNECTION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_ENCODING} - */ - @Deprecated - public static final String CONTENT_ENCODING = HttpHeaders.CONTENT_ENCODING; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LANGUAGE} - */ - @Deprecated - public static final String CONTENT_LANGUAGE = HttpHeaders.CONTENT_LANGUAGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LENGTH} - */ - @Deprecated - public static final String CONTENT_LENGTH = HttpHeaders.CONTENT_LENGTH; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_LOCATION} - */ - @Deprecated - public static final String CONTENT_LOCATION = HttpHeaders.CONTENT_LOCATION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_RANGE} - */ - @Deprecated - public static final String CONTENT_RANGE = HttpHeaders.CONTENT_RANGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_TYPE} - */ - @Deprecated - public static final String CONTENT_TYPE = HttpHeaders.CONTENT_TYPE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#CONTENT_DISPOSITION} - */ - @Deprecated - public static final String CONTENT_DISPOSITION = HttpHeaders.CONTENT_DISPOSITION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#COOKIE} - */ - @Deprecated - public static final String COOKIE = HttpHeaders.COOKIE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#DATE} - */ - @Deprecated - public static final String DATE = HttpHeaders.DATE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#ETAG} - */ - @Deprecated - public static final String ETAG = HttpHeaders.ETAG; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#EXPECT} - */ - @Deprecated - public static final String EXPECT = HttpHeaders.EXPECT; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#EXPIRES} - */ - @Deprecated - public static final String EXPIRES = HttpHeaders.EXPIRES; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#FROM} - */ - @Deprecated - public static final String FROM = HttpHeaders.FROM; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#HOST} - */ - @Deprecated - public static final String HOST = HttpHeaders.HOST; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#IF_MATCH} - */ - @Deprecated - public static final String IF_MATCH = HttpHeaders.IF_MATCH; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#IF_MODIFIED_SINCE} - */ - @Deprecated - public static final String IF_MODIFIED_SINCE = HttpHeaders.IF_MODIFIED_SINCE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#IF_NONE_MATCH} - */ - @Deprecated - public static final String IF_NONE_MATCH = HttpHeaders.IF_NONE_MATCH; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#IF_RANGE} - */ - @Deprecated - public static final String IF_RANGE = HttpHeaders.IF_RANGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#IF_UNMODIFIED_SINCE} - */ - @Deprecated - public static final String IF_UNMODIFIED_SINCE = HttpHeaders.IF_UNMODIFIED_SINCE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#LAST_MODIFIED} - */ - @Deprecated - public static final String LAST_MODIFIED = HttpHeaders.LAST_MODIFIED; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#LOCATION} - */ - @Deprecated - public static final String LOCATION = HttpHeaders.LOCATION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#MAX_FORWARDS} - */ - @Deprecated - public static final String MAX_FORWARDS = HttpHeaders.MAX_FORWARDS; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#PRAGMA} - */ - @Deprecated - public static final String PRAGMA = HttpHeaders.PRAGMA; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#PROXY_AUTHENTICATE} - */ - @Deprecated - public static final String PROXY_AUTHENTICATE = HttpHeaders.PROXY_AUTHENTICATE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#PROXY_AUTHORIZATION} - */ - @Deprecated - public static final String PROXY_AUTHORIZATION = HttpHeaders.PROXY_AUTHORIZATION; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#RANGE} - */ - @Deprecated - public static final String RANGE = HttpHeaders.RANGE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#REFERER} - */ - @Deprecated - public static final String REFERER = HttpHeaders.REFERER; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#RETRY_AFTER} - */ - @Deprecated - public static final String RETRY_AFTER = HttpHeaders.RETRY_AFTER; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#SERVER} - */ - @Deprecated - public static final String SERVER = HttpHeaders.SERVER; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#SET_COOKIE} - */ - @Deprecated - public static final String SET_COOKIE = HttpHeaders.SET_COOKIE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#TE} - */ - @Deprecated - public static final String TE = HttpHeaders.TE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#TRAILER} - */ - @Deprecated - public static final String TRAILER = HttpHeaders.TRAILER; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#UPGRADE} - */ - @Deprecated - public static final String UPGRADE = HttpHeaders.UPGRADE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#USER_AGENT} - */ - @Deprecated - public static final String USER_AGENT = HttpHeaders.USER_AGENT; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#VARY} - */ - @Deprecated - public static final String VARY = HttpHeaders.VARY; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#VIA} - */ - @Deprecated - public static final String VIA = HttpHeaders.VIA; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#WARNING} - */ - @Deprecated - public static final String WARNING = HttpHeaders.WARNING; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#WWW_AUTHENTICATE} - */ - @Deprecated - public static final String WWW_AUTHENTICATE = HttpHeaders.WWW_AUTHENTICATE; - - /** - * @deprecated since 5.2 in favor of {@link HttpHeaders#TRANSFER_ENCODING} - */ - @Deprecated - public static final String TRANSFER_ENCODING = HttpHeaders.TRANSFER_ENCODING; - public static final String CONTENT_MD5 = "Content-MD5"; public static final String REFRESH = "Refresh"; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/AbstractByteArraySerializer.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/AbstractByteArraySerializer.java index b3b5455cf7..6a222d13d3 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/AbstractByteArraySerializer.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/AbstractByteArraySerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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,8 @@ import org.springframework.core.serializer.Serializer; * reconstruct a byte array from an arbitrary stream. * * @author Gary Russell + * @author Artme Bilan + * * @since 2.0 * */ @@ -45,11 +47,10 @@ public abstract class AbstractByteArraySerializer implements */ public static final int DEFAULT_MAX_MESSAGE_SIZE = 2048; - @Deprecated - protected int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; // NOSONAR - TODO private in 5.2, use getter - protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR + private int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; + private ApplicationEventPublisher applicationEventPublisher; /** @@ -57,7 +58,6 @@ public abstract class AbstractByteArraySerializer implements * Default 2048. * @return The max message size. */ - @SuppressWarnings("deprecation") public int getMaxMessageSize() { return this.maxMessageSize; } @@ -67,7 +67,6 @@ public abstract class AbstractByteArraySerializer implements * Default 2048. * @param maxMessageSize The max message size. */ - @SuppressWarnings("deprecation") public void setMaxMessageSize(int maxMessageSize) { this.maxMessageSize = maxMessageSize; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java index dfaac31906..b77edef0cf 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -86,7 +86,7 @@ public class JdbcMessageHandler extends AbstractMessageHandler { private final NamedParameterJdbcOperations jdbcOperations; - private String updateSql; + private final String updateSql; private PreparedStatementCreator generatedKeysStatementCreator; @@ -128,16 +128,6 @@ public class JdbcMessageHandler extends AbstractMessageHandler { this.keysGenerated = keysGenerated; } - /** - * Configure an SQL statement to perform an UPDATE on the target database. - * @param updateSql the SQL statement to perform. - * @deprecated since 5.1.3 in favor of constructor argument. - */ - @Deprecated - public final void setUpdateSql(String updateSql) { - Assert.hasText(updateSql, "'updateSql' must not be empty."); - this.updateSql = updateSql; - } public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) { this.sqlParameterSourceFactory = sqlParameterSourceFactory; diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java index ee3a9e1681..4a6eae773e 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -147,18 +147,6 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource { this.sqlQueryParameterSource = sqlQueryParameterSource; } - /** - * The maximum number of rows to pull out of the query results per poll (if - * greater than zero, otherwise all rows will be packed into the outgoing - * message). Default is zero. - * @param maxRows the max rows to set - * @deprecated since 5.1 in favor of {@link #setMaxRows(int)} - */ - @Deprecated - public void setMaxRowsPerPoll(int maxRows) { - setMaxRows(maxRows); - } - /** * The maximum number of rows to query. Default is zero - select all records. * @param maxRows the max rows to set diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java index 45b2dbfc09..7f0b0e918b 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -475,28 +475,6 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean { this.returningResultSetRowMappers = returningResultSetRowMappers; } - /** - * Allows for the retrieval of metrics. - * @return the metrics. - * @deprecated since 5.2 - * @throws UnsupportedOperationException since this functionality isn't supported any more. - */ - @Deprecated - public Object getJdbcCallOperationsCacheStatistics() { - throw new UnsupportedOperationException("The Google Guava cache isn't supported any more."); - } - - /** - * Allows for the retrieval of metrics. - * @return Map containing metrics of the JdbcCallOperationsCache - * @deprecated since 5.2 - * @throws UnsupportedOperationException since this functionality isn't supported any more. - */ - @Deprecated - public Map getJdbcCallOperationsCacheStatisticsAsMap() { - throw new UnsupportedOperationException("The Google Guava cache isn't supported any more."); - } - /** * Defines the maximum number of {@link SimpleJdbcCallOperations} * A value of zero will disable the cache. The default is 10. 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 a8fc412593..31cd0f8e8f 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-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -114,21 +114,6 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto DELETE_MESSAGE } - /** - * The name of the message header that stores a flag to indicate that the message has been saved. This is an - * optimization for the put method. - * @deprecated since 5.0. This constant isn't used any more. - */ - @Deprecated - public static final String SAVED_KEY = JdbcChannelMessageStore.class.getSimpleName() + ".SAVED"; - - /** - * The name of the message header that stores a timestamp for the time the message was inserted. - * @deprecated since 5.0. This constant isn't used any more. - */ - @Deprecated - public static final String CREATED_DATE_KEY = JdbcChannelMessageStore.class.getSimpleName() + ".CREATED_DATE"; - private final Set idCache = new HashSet<>(); private final ReadWriteLock idCacheLock = new ReentrantReadWriteLock(); 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 6c9d0b704d..b8287a2aeb 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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,9 +31,6 @@ import java.util.concurrent.atomic.AtomicReference; import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.core.serializer.Deserializer; import org.springframework.core.serializer.Serializer; import org.springframework.core.serializer.support.SerializingConverter; @@ -79,8 +76,6 @@ import org.springframework.util.StringUtils; */ public class JdbcMessageStore extends AbstractMessageGroupStore implements MessageStore { - private static final Log logger = LogFactory.getLog(JdbcMessageStore.class); - /** * Default value for the table prefix property. */ @@ -95,13 +90,15 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa UPDATE_MESSAGE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=? where GROUP_KEY=? and REGION=?"), - REMOVE_MESSAGE_FROM_GROUP("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and MESSAGE_ID=? and REGION=?"), + REMOVE_MESSAGE_FROM_GROUP("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and MESSAGE_ID=? and " + + "REGION=?"), REMOVE_GROUP_TO_MESSAGE_JOIN("DELETE from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and REGION=?"), COUNT_ALL_MESSAGES_IN_GROUPS("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where REGION=?"), - COUNT_ALL_MESSAGES_IN_GROUP("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and REGION=?"), + COUNT_ALL_MESSAGES_IN_GROUP("SELECT COUNT(MESSAGE_ID) from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY=? and " + + "REGION=?"), LIST_MESSAGES_BY_GROUP_KEY("SELECT MESSAGE_ID, MESSAGE_BYTES, CREATED_DATE " + "from %PREFIX%MESSAGE where MESSAGE_ID in " + @@ -123,7 +120,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa GET_GROUP_INFO("SELECT COMPLETE, LAST_RELEASED_SEQUENCE, CREATED_DATE, UPDATED_DATE" + " from %PREFIX%MESSAGE_GROUP where GROUP_KEY = ? and REGION=?"), - GET_MESSAGE("SELECT MESSAGE_ID, CREATED_DATE, MESSAGE_BYTES from %PREFIX%MESSAGE where MESSAGE_ID=? and REGION=?"), + GET_MESSAGE("SELECT MESSAGE_ID, CREATED_DATE, MESSAGE_BYTES from %PREFIX%MESSAGE where MESSAGE_ID=? and " + + "REGION=?"), GET_GROUP_CREATED_DATE("SELECT CREATED_DATE from %PREFIX%MESSAGE_GROUP where GROUP_KEY=? and REGION=?"), @@ -138,7 +136,8 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa COMPLETE_GROUP("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, COMPLETE=1 where GROUP_KEY=? and REGION=?"), - UPDATE_LAST_RELEASED_SEQUENCE("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, LAST_RELEASED_SEQUENCE=? where GROUP_KEY=? and REGION=?"), + UPDATE_LAST_RELEASED_SEQUENCE("UPDATE %PREFIX%MESSAGE_GROUP set UPDATED_DATE=?, LAST_RELEASED_SEQUENCE=? where " + + "GROUP_KEY=? and REGION=?"), DELETE_MESSAGES_FROM_GROUP("DELETE from %PREFIX%MESSAGE where MESSAGE_ID in " + "(SELECT MESSAGE_ID from %PREFIX%GROUP_TO_MESSAGE where GROUP_KEY = ? and REGION = ?) and REGION = ?"), @@ -164,36 +163,21 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa } } - /** - * The name of the message header that stores a flag to indicate that the message has been saved. This is an - * optimization for the put method. - * @deprecated since 5.0. This constant isn't used any more. - */ - @Deprecated - public static final String SAVED_KEY = JdbcMessageStore.class.getSimpleName() + ".SAVED"; - - /** - * The name of the message header that stores a timestamp for the time the message was inserted. - * @deprecated since 5.0. This constant isn't used any more. - */ - @Deprecated - public static final String CREATED_DATE_KEY = JdbcMessageStore.class.getSimpleName() + ".CREATED_DATE"; - private final MessageMapper mapper = new MessageMapper(); - private volatile String region = "DEFAULT"; - - private volatile String tablePrefix = DEFAULT_TABLE_PREFIX; - private final JdbcOperations jdbcTemplate; - private volatile WhiteListDeserializingConverter deserializer; + private final Map queryCache = new HashMap<>(); - private volatile SerializingConverter serializer; + private String region = "DEFAULT"; - private volatile LobHandler lobHandler = new DefaultLobHandler(); + private String tablePrefix = DEFAULT_TABLE_PREFIX; - private volatile Map queryCache = new HashMap(); + private WhiteListDeserializingConverter deserializer; + + private SerializingConverter serializer; + + private LobHandler lobHandler = new DefaultLobHandler(); /** * Create a {@link MessageStore} with all mandatory properties. @@ -357,8 +341,9 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa @Override public void addMessagesToGroup(Object groupId, Message... messages) { final String groupKey = getKey(groupId); - boolean groupNotExist = this.jdbcTemplate.queryForObject(this.getQuery(Query.GROUP_EXISTS), // NOSONAR query never returns null - Integer.class, groupKey, this.region) < 1; + boolean groupNotExist = this.jdbcTemplate + .queryForObject(this.getQuery(Query.GROUP_EXISTS), // NOSONAR query never returns null + Integer.class, groupKey, this.region) < 1; final Timestamp updatedDate = new Timestamp(System.currentTimeMillis()); @@ -408,16 +393,18 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa @Override @ManagedAttribute public int getMessageCountForAllMessageGroups() { - return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), // NOSONAR query never returns null - Integer.class, this.region); + return this.jdbcTemplate + .queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUPS), // NOSONAR query never returns null + Integer.class, this.region); } @Override @ManagedAttribute public int messageGroupSize(Object groupId) { String key = getKey(groupId); - return this.jdbcTemplate.queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), // NOSONAR query never returns null - Integer.class, key, this.region); + return this.jdbcTemplate + .queryForObject(getQuery(Query.COUNT_ALL_MESSAGES_IN_GROUP), // NOSONAR query never returns null + Integer.class, key, this.region); } @Override diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapMailInboundChannelAdapterSpec.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapMailInboundChannelAdapterSpec.java index e1efeb78b5..a09671d514 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapMailInboundChannelAdapterSpec.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapMailInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 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. @@ -66,20 +66,4 @@ public class ImapMailInboundChannelAdapterSpec return this; } - /** - * How often to recycle the idle task (in case of a silently dropped connection). - * Seconds; default 120 (2 minutes). - * @param interval the interval. - * @return the spec. - * @see ImapMailReceiver#setCancelIdleInterval(long) - * @since 5.0.10 - * @deprecated since 5.2: there is no idle task started for polling channel adapter. - */ - @Deprecated - public ImapMailInboundChannelAdapterSpec cancelIdleInterval(long interval) { - assertReceiver(); - this.receiver.setCancelIdleInterval(interval); - return this; - } - } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParser.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParser.java index 2f04c6a3d6..559be1fcad 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParser.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2020 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. @@ -29,7 +29,9 @@ import org.springframework.util.StringUtils; /** * Parser for MongoDb outbound gateways * - * @author Xavier Padr? + * @author Xavier Padro + * @author Artem Bilan + * * @since 5.0 */ public class MongoDbOutboundGatewayParser extends AbstractConsumerEndpointParser { @@ -50,11 +52,11 @@ public class MongoDbOutboundGatewayParser extends AbstractConsumerEndpointParser if (StringUtils.hasText(element.getAttribute("query")) || StringUtils.hasText(element.getAttribute("query-expression"))) { - parserContext.getReaderContext().error("'collection-callback' is not allowed with " + - "'query' or 'query-expression'", element); + parserContext.getReaderContext() + .error("'collection-callback' is not allowed with 'query' or 'query-expression'", element); } - builder.addPropertyReference("collectionCallback", collectionCallback); + builder.addPropertyReference("messageCollectionCallback", collectionCallback); } else { BeanDefinition queryExpressionDef = diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java index 5b195680ec..b3a5f37053 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java @@ -19,7 +19,6 @@ package org.springframework.integration.mongodb.outbound; import org.bson.Document; import org.springframework.data.mongodb.MongoDbFactory; -import org.springframework.data.mongodb.core.CollectionCallback; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; @@ -40,7 +39,7 @@ import org.springframework.util.Assert; /** * Makes outbound operations to query a MongoDb database using a {@link MongoOperations} * - * @author Xavier Padr? + * @author Xavier Padro * @author Artem Bilan * * @since 5.0 @@ -92,21 +91,6 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler this.queryExpression = EXPRESSION_PARSER.parseExpression(queryExpressionString); } - /** - * Specify a {@link CollectionCallback} to perform against MongoDB collection. - * @param collectionCallback the callback to perform against MongoDB collection. - * @deprecated in favor of {@link #setMessageCollectionCallback(MessageCollectionCallback)}. - * Will be removed in 5.2 - */ - @Deprecated - public void setCollectionCallback(CollectionCallback collectionCallback) { - Assert.notNull(collectionCallback, "'collectionCallback' must not be null."); - this.collectionCallback = - collectionCallback instanceof MessageCollectionCallback - ? (MessageCollectionCallback) collectionCallback - : (collection, requestMessage) -> collectionCallback.doInCollection(collection); - } - /** * Specify a {@link MessageCollectionCallback} to perform against MongoDB collection * in the request message context. @@ -171,21 +155,21 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler protected Object handleRequestMessage(Message requestMessage) { String collectionName = this.collectionNameExpression.getValue(this.evaluationContext, requestMessage, String.class); - // TODO: 5.2 assert not null + Assert.notNull(collectionName, "'collectionNameExpression' cannot evaluate to null"); Object result; if (this.collectionCallback != null) { - result = this.mongoTemplate.execute(collectionName, // NOSONAR + result = this.mongoTemplate.execute(collectionName, collection -> this.collectionCallback.doInCollection(collection, requestMessage)); } else { Query query = buildQuery(requestMessage); if (this.expectSingleResult) { - result = this.mongoTemplate.findOne(query, this.entityClass, collectionName); // NOSONAR + result = this.mongoTemplate.findOne(query, this.entityClass, collectionName); } else { - result = this.mongoTemplate.find(query, this.entityClass, collectionName); // NOSONAR + result = this.mongoTemplate.find(query, this.entityClass, collectionName); } } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoDbMessageBytesConverter.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoDbMessageBytesConverter.java deleted file mode 100644 index 2e91f40178..0000000000 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoDbMessageBytesConverter.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2016-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.mongodb.support; - -import java.util.HashSet; -import java.util.Set; - -import org.bson.types.Binary; - -import org.springframework.core.convert.TypeDescriptor; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.GenericConverter; -import org.springframework.core.serializer.support.SerializingConverter; -import org.springframework.data.convert.ReadingConverter; -import org.springframework.data.convert.WritingConverter; -import org.springframework.integration.support.converter.WhiteListDeserializingConverter; -import org.springframework.messaging.Message; - -/** - * A {@link GenericConverter} implementation to convert {@link Message} to - * serialized {@link byte[]} to store {@link Message} to the MongoDB. - * And vice versa - to convert {@link byte[]} from the MongoDB to the {@link Message}. - - * @author Artem Bilan - * @author Gary Russell - * @since 4.2.10 - * @deprecated since 5.0 in favor of {@link MessageToBinaryConverter} and {@link BinaryToMessageConverter} - */ -@WritingConverter -@ReadingConverter -@Deprecated -public class MongoDbMessageBytesConverter implements GenericConverter { - - private final Converter serializingConverter = new SerializingConverter(); - - private final WhiteListDeserializingConverter deserializingConverter = new WhiteListDeserializingConverter(); - - @Override - public Set getConvertibleTypes() { - Set convertiblePairs = new HashSet<>(); - convertiblePairs.add(new ConvertiblePair(Message.class, Binary.class)); - convertiblePairs.add(new ConvertiblePair(Binary.class, Message.class)); - return convertiblePairs; - } - - @Override - public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - if (source == null) { - return null; - } - if (Message.class.isAssignableFrom(sourceType.getObjectType())) { - return new Binary(this.serializingConverter.convert(source)); - } - else { - return this.deserializingConverter.convert(((Binary) source).getData()); - } - } - - /** - * Add patterns for packages/classes that are allowed to be deserialized. A class can - * be fully qualified or a wildcard '*' is allowed at the beginning or end of the - * class name. Examples: {@code com.foo.*}, {@code *.MyClass}. - * @param patterns the patterns. - */ - public void addWhiteListPatterns(String... patterns) { - this.deserializingConverter.addWhiteListPatterns(patterns); - } - -} diff --git a/spring-integration-mongodb/src/main/resources/org/springframework/integration/mongodb/config/spring-integration-mongodb.xsd b/spring-integration-mongodb/src/main/resources/org/springframework/integration/mongodb/config/spring-integration-mongodb.xsd index 40bc619222..5c810f164d 100644 --- a/spring-integration-mongodb/src/main/resources/org/springframework/integration/mongodb/config/spring-integration-mongodb.xsd +++ b/spring-integration-mongodb/src/main/resources/org/springframework/integration/mongodb/config/spring-integration-mongodb.xsd @@ -251,8 +251,6 @@ Reference to an instance of - org.springframework.data.mongodb.core.CollectionCallback, preferable an - instance of org.springframework.integration.mongodb.outbound.MessageCollectionCallback with the request message context. diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml index c8bc944d8b..484e61c199 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml @@ -58,7 +58,7 @@ - + diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests.java index 601d72844d..ff144671ba 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests.java @@ -17,11 +17,11 @@ package org.springframework.integration.mongodb.config; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; @@ -39,17 +39,15 @@ import org.springframework.integration.mongodb.outbound.MongoDbOutboundGateway; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageHandler; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** - * @author Xavier Padr? + * @author Xavier Padro * @author Artem Bilan * * @since 5.0 */ -@ContextConfiguration -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class MongoDbOutboundGatewayParserTests { @@ -139,22 +137,28 @@ public class MongoDbOutboundGatewayParserTests { .isInstanceOf(MessageCollectionCallback.class); } - @Test(expected = BeanDefinitionParsingException.class) + @Test public void templateAndFactoryFail() { - new ClassPathXmlApplicationContext("outbound-gateway-fail-template-factory-config.xml", this.getClass()) - .close(); + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("outbound-gateway-fail-template-factory-config.xml", + getClass())); } - @Test(expected = BeanDefinitionParsingException.class) + @Test public void templateAndConverterFail() { - new ClassPathXmlApplicationContext("outbound-gateway-fail-template-converter-config.xml", - this.getClass()).close(); + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("outbound-gateway-fail-template-converter-config.xml", + this.getClass())); } - @Test(expected = BeanDefinitionParsingException.class) + @Test public void collectionCallbackAndQueryFail() { - new ClassPathXmlApplicationContext("outbound-gateway-fail-collection-callback-config.xml", - this.getClass()).close(); + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("outbound-gateway-fail-collection-callback-config.xml", + this.getClass())); } } diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java index 96b97f0146..c17eed727e 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -16,11 +16,6 @@ package org.springframework.integration.mqtt.core; -import java.util.Arrays; -import java.util.Properties; - -import javax.net.SocketFactory; - import org.eclipse.paho.client.mqttv3.IMqttAsyncClient; import org.eclipse.paho.client.mqttv3.IMqttClient; import org.eclipse.paho.client.mqttv3.MqttAsyncClient; @@ -36,6 +31,7 @@ import org.springframework.util.Assert; * * @author Gary Russell * @author Gunnar Hillert + * * @since 4.0 * */ @@ -47,87 +43,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { private ConsumerStopAction consumerStopAction = ConsumerStopAction.UNSUBSCRIBE_CLEAN; - /** - * Set the cleanSession. - * @param cleanSession the cleanSession to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setCleanSession(Boolean cleanSession) { - this.options.setCleanSession(cleanSession); - } - - /** - * Set the connectionTimeout. - * @param connectionTimeout the connectionTimeout to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setConnectionTimeout(Integer connectionTimeout) { - this.options.setConnectionTimeout(connectionTimeout); - } - - /** - * Set the keepAliveInterval. - * @param keepAliveInterval the keepAliveInterval to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setKeepAliveInterval(Integer keepAliveInterval) { - this.options.setKeepAliveInterval(keepAliveInterval); - } - - /** - * Set the password. - * @param password the password to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setPassword(String password) { - this.options.setPassword(password.toCharArray()); - } - - /** - * Set the socketFactory. - * @param socketFactory the socketFactory to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setSocketFactory(SocketFactory socketFactory) { - this.options.setSocketFactory(socketFactory); - } - - /** - * Set the sslProperties. - * @param sslProperties the sslProperties to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setSslProperties(Properties sslProperties) { - this.options.setSSLProperties(sslProperties); - } - - /** - * Set the userName. - * @param userName the userName to set. - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setUserName(String userName) { - this.options.setUserName(userName); - } - - /** - * Will be used to set the "Last Will and Testament" (LWT) for the connection. - * @param will The will. - * @see MqttConnectOptions#setWill - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setWill(Will will) { - this.options.setWill(will.getTopic(), will.getPayload(), will.getQos(), will.isRetained()); - } - /** * Set the persistence to pass into the client constructor. * @param persistence the persistence to set. @@ -136,19 +51,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { this.persistence = persistence; } - /** - * Use this when using multiple server instances, for example when using HA. - * @param serverURIs The URIs. - * @see MqttConnectOptions#setServerURIs(String[]) - * @since 4.1 - * @deprecated use {@link #setConnectionOptions(MqttConnectOptions)} instead. - */ - @Deprecated - public void setServerURIs(String... serverURIs) { - Assert.notNull(serverURIs, "'serverURIs' must not be null."); - this.options.setServerURIs(Arrays.copyOf(serverURIs, serverURIs.length)); - } - /** * Get the consumer stop action. * @return the consumer stop action. diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisUtils.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisUtils.java deleted file mode 100644 index 1543f1a5ef..0000000000 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2018-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.redis.util; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; - -import org.springframework.data.redis.core.RedisCallback; -import org.springframework.data.redis.core.RedisOperations; -import org.springframework.util.StringUtils; - -/** - * A set of utility methods for common Redis functions. - * - * @author Artem Bilan - * @author Gary Russell - * - * @since 5.1 - */ -public final class RedisUtils { - - private static final String SECTION = "server"; - - private static final String VERSION_PROPERTY = "redis_version"; - - @SuppressWarnings("serial") - private static final Map, Boolean> unlinkAvailable = - Collections.synchronizedMap(new LinkedHashMap, Boolean>() { - - @Override - protected boolean removeEldestEntry(Entry, Boolean> eldest) { - return size() > 100; - } - - }); - - /** - * Perform an {@code INFO} command on the provided {@link RedisOperations} to check - * the Redis server version to be sure that {@code UNLINK} is available or not. - * @param redisOperations the {@link RedisOperations} to perform {@code INFO} command. - * @return true or false if {@code UNLINK} Redis command is available or not. - * @throws IllegalStateException when {@code INFO} returns null from the Redis. - * @deprecated since 5.1.8 in favor of explicit trials in the target code. - * The INFO command might not be available on the server, but UNLINK might. - * Will be removed in version 5.3. - */ - @Deprecated - public static boolean isUnlinkAvailable(RedisOperations redisOperations) { - return unlinkAvailable.computeIfAbsent(redisOperations, key -> { - Properties info = redisOperations.execute( - (RedisCallback) connection -> connection.serverCommands().info(SECTION)); - if (info != null) { - String version = info.getProperty(VERSION_PROPERTY); - if (StringUtils.hasText(version)) { - int majorVersion = Integer.parseInt(version.split("\\.")[0]); - return majorVersion >= 4; - } - else { - return false; - } - } - else { - throw new IllegalStateException("The INFO command cannot be used in pipeline/transaction."); - } - }); - } - - private RedisUtils() { - } - -} diff --git a/spring-integration-rmi/src/test/java/org/springframework/integration/rmi/BackToBackTests-context.xml b/spring-integration-rmi/src/test/java/org/springframework/integration/rmi/BackToBackTests-context.xml index 239207f5b8..cf6b8bdcdc 100644 --- a/spring-integration-rmi/src/test/java/org/springframework/integration/rmi/BackToBackTests-context.xml +++ b/spring-integration-rmi/src/test/java/org/springframework/integration/rmi/BackToBackTests-context.xml @@ -29,7 +29,7 @@ - + diff --git a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSocketOutboundGatewaySpec.java b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSocketOutboundGatewaySpec.java index 87d3c47324..4ad7b968b2 100644 --- a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSocketOutboundGatewaySpec.java +++ b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSocketOutboundGatewaySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2020 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,18 +58,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec(command)); - } - /** * Configure an {@link RSocketInteractionModel} for the RSocket request type. * @param interactionModel the {@link RSocketInteractionModel} to use. @@ -81,20 +69,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec(interactionModel)); } - /** - * Configure a {@link Function} to evaluate an {@link RSocketOutboundGateway.Command} - * for the RSocket request type at runtime against a request message. - * @param commandFunction the {@code Function} to use. - * @param

the expected request message payload type. - * @return the spec - * @see RSocketOutboundGateway#setInteractionModelExpression(Expression) - * @deprecated in favor of {@link #interactionModel(Function)} - */ - @Deprecated - public

RSocketOutboundGatewaySpec command(Function, ?> commandFunction) { - return interactionModel(commandFunction); - } - /** * Configure a {@link Function} to evaluate an {@link RSocketInteractionModel} * for the RSocket request type at runtime against a request message. @@ -108,19 +82,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec(interactionModelFunction)); } - /** - * Configure a SpEL expression to evaluate an {@link RSocketOutboundGateway.Command} - * for the RSocket request type at runtime against a request message. - * @param commandExpression the SpEL expression to use. - * @return the spec - * @see RSocketOutboundGateway#setInteractionModelExpression(Expression) - * @deprecated in favor of {@link #interactionModel(String)} - */ - @Deprecated - public RSocketOutboundGatewaySpec command(String commandExpression) { - return interactionModel(commandExpression); - } - /** * Configure a SpEL expression to evaluate an {@link RSocketInteractionModel} * for the RSocket request type at runtime against a request message. @@ -133,19 +94,6 @@ public class RSocketOutboundGatewaySpec extends MessageHandlerSpec(command.interactionModel)); - } - /** * Configure an {@link RSocketInteractionModel} for the RSocket request type. * @param interactionModel the {@link RSocketInteractionModel} to use. @@ -149,17 +139,6 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler setInteractionModelExpression(new ValueExpression<>(interactionModel)); } - /** - * Configure a SpEL expression to evaluate a {@link Command} for the RSocket request type at runtime - * against a request message. - * @param commandExpression the SpEL expression to use. - * @deprecated in favor of {@link #setInteractionModelExpression(Expression)} - */ - @Deprecated - public void setCommandExpression(Expression commandExpression) { - setInteractionModelExpression(commandExpression); - } - /** * Configure a SpEL expression to evaluate an {@link RSocketInteractionModel} * for the RSocket request type at runtime against a request message. @@ -337,9 +316,6 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler if (value instanceof RSocketInteractionModel) { return (RSocketInteractionModel) value; } - else if (value instanceof Command) { - return ((Command) value).interactionModel; - } else if (value instanceof String) { return RSocketInteractionModel.valueOf((String) value); } @@ -372,39 +348,4 @@ public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler } } - /** - * Enumeration of commands supported by the gateways. - * @deprecated in favor of {@link RSocketInteractionModel} - */ - @Deprecated - public enum Command { - - /** - * Perform {@link io.rsocket.RSocket#fireAndForget fireAndForget}. - * @see RSocketRequester.RequestSpec#send() - */ - fireAndForget(RSocketInteractionModel.fireAndForget), - - /** - * Perform {@link io.rsocket.RSocket#requestResponse requestResponse}. - * @see RSocketRequester.RequestSpec#retrieveMono - */ - requestResponse(RSocketInteractionModel.requestResponse), - - /** - * Perform {@link io.rsocket.RSocket#requestStream requestStream} or - * {@link io.rsocket.RSocket#requestChannel requestChannel} depending on whether - * the request input consists of a single or multiple payloads. - * @see RSocketRequester.RequestSpec#retrieveFlux - */ - requestStreamOrChannel(RSocketInteractionModel.requestStream); - - private final RSocketInteractionModel interactionModel; - - Command(RSocketInteractionModel interactionModel) { - this.interactionModel = interactionModel; - } - - } - } diff --git a/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterParserTests-context.xml b/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterParserTests-context.xml index 1f7ef35828..61846f157a 100644 --- a/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterParserTests-context.xml +++ b/spring-integration-syslog/src/test/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterParserTests-context.xml @@ -9,9 +9,9 @@ http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + @@ -23,7 +23,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -58,10 +58,10 @@ send-timeout="456" error-channel="errors" /> - diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java deleted file mode 100644 index 0f5c8f6e08..0000000000 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/EventuallyMatcher.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2013-2019 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.test.matcher; - -import org.hamcrest.Description; -import org.hamcrest.DiagnosingMatcher; -import org.hamcrest.Matcher; - - -/** - * A matcher that will evaluate another matcher repeatedly until it matches, or fail after some number of attempts. - * - * @param the type the wrapped matcher operates on - * - * @author Eric Bottard - * @author Artem Bilan - * - * @since 4.2 - * - * @deprecated since 5.2 in favor of Awaitility - */ -@Deprecated -public class EventuallyMatcher extends DiagnosingMatcher { - - private final Matcher delegate; - - private int nbAttempts; - - private int pause; - - public EventuallyMatcher(Matcher delegate) { - this(delegate, 20, 100); - } - - public EventuallyMatcher(Matcher delegate, int nbAttempts, int pause) { - this.delegate = delegate; - this.nbAttempts = nbAttempts; - this.pause = pause; - } - - public static Matcher eventually(int nbAttempts, int pause, Matcher delegate) { - return new EventuallyMatcher<>(delegate, nbAttempts, pause); - } - - public static Matcher eventually(Matcher delegate) { - return new EventuallyMatcher<>(delegate); - } - - @Override - public void describeTo(Description description) { - description.appendDescriptionOf(this.delegate) - .appendText(String.format(", trying at most %d times", this.nbAttempts)); - } - - @Override - protected boolean matches(Object item, Description mismatchDescription) { - mismatchDescription.appendText( - String.format("failed after %d*%d=%dms:%n", this.nbAttempts, this.pause, - this.nbAttempts * this.pause)); - - for (int i = 0; i < this.nbAttempts; i++) { - boolean result = this.delegate.matches(item); - if (result) { - return true; - } - this.delegate.describeMismatch(item, mismatchDescription); - mismatchDescription.appendText(", "); - try { - Thread.sleep(this.pause); - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - break; - } - } - return false; - } - -} diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MapContentMatchers.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MapContentMatchers.java index fadc1ce059..8dd38e2728 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MapContentMatchers.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MapContentMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -92,48 +92,8 @@ public final class MapContentMatchers extends TypeSafeMatcher the key type. - * @param the value type. - * @return the {@link Matcher} for map entry. - * @deprecated since 5.2 in favor of {@link Matchers#hasEntry(Object, Object)}. - */ - @Deprecated - public static Matcher> hasEntry(K key, V value) { - return Matchers.hasEntry(key, value); - } - - /** - * Create {@link Matcher} for map entry. - * @param key the key to check. - * @param valueMatcher the {@link Matcher} for value. - * @param the key type. - * @param the value type. - * @return the {@link Matcher} for map entry. - * @deprecated since 5.2 in favor of {@link Matchers#hasEntry(Matcher, Matcher)}. - */ - @Deprecated - public static Matcher> hasEntry(T key, Matcher valueMatcher) { - return Matchers.hasEntry(Matchers.is(key), valueMatcher); - } - - /** - * Create {@link Matcher} for map key. - * @param key the key to check. - * @param the key type. - * @return {@link Matcher} for map key. - * @deprecated since 5.2 in favor of {@link Matchers#hasKey}. - */ - @Deprecated - public static Matcher> hasKey(T key) { - return Matchers.hasKey(key); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static Matcher> hasAllEntries(Map entries) { + @SuppressWarnings("unchecked") + public static Matcher> hasAllEntries(Map entries) { List>> matchers = new ArrayList<>(entries.size()); for (Map.Entry entry : entries.entrySet()) { final V value = entry.getValue(); @@ -144,8 +104,7 @@ public final class MapContentMatchers extends TypeSafeMatcher - * {@code - * ...port="#{T(org.springframework.integration.test.util.SocketUtils).findAvailableServerSocket(12000)}" - * } - * - * But unfortunately, you would need to repeat the package for each usage. - * This will be acceptable for single use, but if you need to invoke the - * methods numerous time, you may instead want to do this: - *

-	 * {@code
-	 * 
-	 *
-	 * ...port="#{tcpIpUtils.findAvailableServerSocket(12000)}"
-	 * }
-	 * 
- */ - private SocketUtils() { - } - - /** - * Determines a free available server socket (port) using the 'seed' value as - * the starting port. The utility methods will probe for 200 sockets but will - * return as soon an open port is found. - * @param seed The starting port, which must not be negative. - * @return An available port number - * @throws IllegalStateException when no open port was found. - */ - public static int findAvailableServerSocket(int seed) { - final List openPorts = findAvailableServerSockets(seed, 1); - return openPorts.get(0); - } - - /** - * Determines a free available server socket (port) using the 'seed' value as - * the starting port. The utility methods will probe for 200 sockets but will - * return as soon an open port is found. - * @param seed The starting port, which must not be negative. - * @param numberOfRequestedPorts How many open ports shall be retrieved? - * @return A list containing the requested number of open ports - * @throws IllegalStateException when no open port was found. - */ - public static List findAvailableServerSockets(int seed, int numberOfRequestedPorts) { - - Assert.isTrue(seed >= 0, "'seed' must not be negative"); - Assert.isTrue(numberOfRequestedPorts > 0, "'numberOfRequestedPorts' must not be negative"); - - final List openPorts = new ArrayList(numberOfRequestedPorts); - - for (int i = seed; i < seed + 200; i = i == 0 ? i : i + 1) { - try { - ServerSocket sock = ServerSocketFactory.getDefault() - .createServerSocket(i, 1, InetAddress.getByName("localhost")); - sock.close(); - openPorts.add(i == 0 ? sock.getLocalPort() : i); - - if (openPorts.size() == numberOfRequestedPorts) { - return openPorts; - } - - } - catch (@SuppressWarnings("unused") IOException e) { - // empty - } - } - - throw new IllegalStateException(String.format("Cannot find a free server socket (%s requested)", - numberOfRequestedPorts)); - } - - /** - * Determines a free available server socket (port) using an automatically - * chosen start seed port. - * @return An available port number - * @throws IllegalStateException when no open port was found. - */ - public static int findAvailableServerSocket() { - int seed = getRandomSeedPort(); - return findAvailableServerSocket(seed); - } - - /** - * Determines a free available Udp socket (port) using the 'seed' value as - * the starting port. The utility methods will probe for 200 sockets but will - * return as soon an open port is found. - * @param seed The starting port, which must not be negative. - * @return An available port number - * @throws IllegalStateException when no open port was found. - */ - public static int findAvailableUdpSocket(int seed) { - final List openPorts = findAvailableUdpSockets(seed, 1); - return openPorts.get(0); - } - - /** - * Determines free available udp socket(s) (port) using the 'seed' value as - * the starting port. The utility methods will probe for 200 sockets but will - * return as soon an open port is found. - * @param seed The starting port, which must not be negative. - * @param numberOfRequestedPorts How many open ports shall be retrieved? - * @return A list containing the requested number of open ports - * @throws IllegalStateException when no open port was found. - */ - public static List findAvailableUdpSockets(int seed, int numberOfRequestedPorts) { - - Assert.isTrue(seed >= 0, "'seed' must not be negative"); - Assert.isTrue(numberOfRequestedPorts > 0, "'numberOfRequestedPorts' must not be negative"); - - final List openPorts = new ArrayList(numberOfRequestedPorts); - - for (int i = seed; i < seed + 200; i++) { - try { - DatagramSocket sock = new DatagramSocket(i, InetAddress.getByName("localhost")); - sock.close(); - Thread.sleep(100); - - openPorts.add(i); - - if (openPorts.size() == numberOfRequestedPorts) { - return openPorts; - } - - } - catch (@SuppressWarnings("unused") IOException e) { - // empty - } - catch (@SuppressWarnings("unused") InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - - throw new IllegalStateException(String.format("Cannot find a free server socket (%s requested)", - numberOfRequestedPorts)); - } - - /** - * Determines a free available Udp socket using an automatically - * chosen start seed port. - * @return An available port number - * @throws IllegalStateException when no open port was found. - */ - public static int findAvailableUdpSocket() { - int seed = getRandomSeedPort(); - return findAvailableUdpSocket(seed); - } - - /** - * Determines a random seed port number within the port range - * {@value #DEFAULT_PORT_RANGE_MIN} and {@value #DEFAULT_PORT_RANGE_MAX}. - * @return A number with the the specified range - */ - public static int getRandomSeedPort() { - return new Random().nextInt(DEFAULT_PORT_RANGE_MAX - DEFAULT_PORT_RANGE_MIN + 1) + DEFAULT_PORT_RANGE_MIN; - } - -} diff --git a/src/reference/asciidoc/dsl.adoc b/src/reference/asciidoc/dsl.adoc index 1f1e9b01c0..909c554d4c 100644 --- a/src/reference/asciidoc/dsl.adoc +++ b/src/reference/asciidoc/dsl.adoc @@ -968,7 +968,7 @@ public class MyFlowAdapter extends IntegrationFlowAdapter { @Override protected IntegrationFlowDefinition buildFlow() { - return from(this, "messageSource", + return from(this::messageSource, e -> e.poller(p -> p.trigger(this::nextExecutionTime))) .split(this) .transform(this) @@ -1174,7 +1174,7 @@ By default a `GatewayProxyFactoryBean` gets a conventional bean name, such as `[ You can change that ID by using the `@MessagingGateway.name()` attribute or the overloaded `IntegrationFlows.from(Class serviceInterface, Consumer endpointConfigurer)` factory method. Also all the attributes from the `@MessagingGateway` annotation on the interface are applied to the target `GatewayProxyFactoryBean`. When annotation configuration is not applicable, the `Consumer` variant can be used for providing appropriate option for the target proxy. -This DSL method is available starting with version 5.2; the method `IntegrationFlows.from(Class serviceInterface, String beanName)` is deprecated in favor of `GatewayProxySpec.beanName()` option. +This DSL method is available starting with version 5.2. With Java 8, you can even create an integration gateway with the `java.util.function` interfaces, as the following example shows: diff --git a/src/reference/asciidoc/testing.adoc b/src/reference/asciidoc/testing.adoc index cf20307e2c..16a52b1864 100644 --- a/src/reference/asciidoc/testing.adoc +++ b/src/reference/asciidoc/testing.adoc @@ -70,16 +70,16 @@ See the https://docs.spring.io/spring-integration/api/org/springframework/integr ==== Using the `SocketUtils` Class -The https://docs.spring.io/spring-integration/api/org/springframework/integration/test/util/SocketUtils.html[`SocketUtils` class] provides several methods that select one or more random ports for exposing server-side components without conflicts, as the following example shows: +The https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/SocketUtils.html[`SocketUtils` class] provides several methods that select one or more random ports for exposing server-side components without conflicts, as the following example shows: ==== [source,xml] ---- - + + port="#{socketUtils.findAvailableUdpPort(1514)}" /> diff --git a/src/reference/asciidoc/transformer.adoc b/src/reference/asciidoc/transformer.adoc index aaf411e256..ea2a76b51b 100644 --- a/src/reference/asciidoc/transformer.adoc +++ b/src/reference/asciidoc/transformer.adoc @@ -359,14 +359,10 @@ To avoid unexpected issues with JSON mapping features when you use annotations, [source,java] ---- -@org.codehaus.jackson.annotate.JsonIgnoreProperties(ignoreUnknown=true) @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown=true) -@org.boon.json.annotations.JsonIgnoreProperties("thing1") public class Thing1 { - @org.codehaus.jackson.annotate.JsonProperty("thing1Thing2") @com.fasterxml.jackson.annotation.JsonProperty("thing1Thing2") - @org.boon.json.annotations.JsonProperty("thing1Thing2") public Object thing2; }