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 7c0c99c2bd..af300c284a 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-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -522,7 +522,6 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint @Override @Nullable - @SuppressWarnings("removal") public Object invoke(final MethodInvocation invocation) throws Throwable { // NOSONAR Method method = invocation.getMethod(); Class returnType; @@ -541,13 +540,6 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint else if (CompletableFuture.class.equals(returnType)) { // exact return CompletableFuture.supplyAsync(invoker, this.asyncExecutor); } - else if (org.springframework.util.concurrent.ListenableFuture.class.equals(returnType)) { - logger.warn("The 'org.springframework.util.concurrent.ListenableFuture' is deprecated for removal." + - "The 'CompletableFuture' is recommended to be used instead." + - "The 'ListenableFuture' support will be removed in Spring Integration 6.5."); - return ((org.springframework.core.task.AsyncListenableTaskExecutor) this.asyncExecutor) - .submitListenable(invoker::get); - } else if (Future.class.isAssignableFrom(returnType)) { logger.debug(() -> "AsyncTaskExecutor submit*() return types are incompatible with the method return " + "type; running on calling thread; the downstream flow must return the required Future: " diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java index ac9bb80e73..c6805ef31c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -321,7 +321,6 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan return replyChannel; } - @SuppressWarnings("removal") private void doProduceOutput(Message requestMessage, MessageHeaders requestHeaders, Object reply, @Nullable Object replyChannelArg) { @@ -331,9 +330,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan } if (this.async) { - boolean isFutureReply = - reply instanceof org.springframework.util.concurrent.ListenableFuture || - reply instanceof CompletableFuture; + boolean isFutureReply = reply instanceof CompletableFuture; ReactiveAdapter reactiveAdapter = null; if (!isFutureReply) { @@ -366,7 +363,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan return reactiveAdapter.toPublisher(reply); } else { - return Mono.fromFuture(toCompletableFuture(reply)); + return Mono.fromFuture((CompletableFuture) reply); } } @@ -415,20 +412,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan return replyFuture; } else { - return toCompletableFuture(reply); - } - } - - @SuppressWarnings("removal") - private CompletableFuture toCompletableFuture(Object reply) { - if (reply instanceof CompletableFuture completableFuture) { - return completableFuture; - } - else { - logger.warn("The 'org.springframework.util.concurrent.ListenableFuture' is deprecated for removal." + - "The 'CompletableFuture' is recommended to be used instead." + - "The 'ListenableFuture' support will be removed in Spring Integration 6.5."); - return ((org.springframework.util.concurrent.ListenableFuture) reply).completable(); + return (CompletableFuture) reply; } } diff --git a/src/reference/antora/modules/ROOT/pages/whats-new.adoc b/src/reference/antora/modules/ROOT/pages/whats-new.adoc index 61ced0381a..3a225ad7ac 100644 --- a/src/reference/antora/modules/ROOT/pages/whats-new.adoc +++ b/src/reference/antora/modules/ROOT/pages/whats-new.adoc @@ -13,3 +13,8 @@ If you are interested in more details, see the Issue Tracker tickets that were r In general the project has been moved to the latest dependency versions. +[[x6.5-general]] +== General Changes + +The deprecated previously usage of `org.springframework.util.concurrent.ListenableFuture` has been removed in favor of `CompletableFuture`. +