Skip to content

Commit aac3ccf

Browse files
committed
Adapt to deprecations in Spring Framework
See spring-projects/spring-framework#27780
1 parent ac12035 commit aac3ccf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.autoconfigure.task;
1818

19+
import java.util.concurrent.CompletableFuture;
1920
import java.util.concurrent.Executor;
2021
import java.util.concurrent.Future;
2122
import java.util.function.Consumer;
@@ -37,7 +38,6 @@
3738
import org.springframework.core.task.TaskDecorator;
3839
import org.springframework.core.task.TaskExecutor;
3940
import org.springframework.scheduling.annotation.Async;
40-
import org.springframework.scheduling.annotation.AsyncResult;
4141
import org.springframework.scheduling.annotation.EnableAsync;
4242
import org.springframework.scheduling.annotation.EnableScheduling;
4343
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -213,7 +213,7 @@ static class TestBean {
213213

214214
@Async
215215
Future<String> echo(String text) {
216-
return new AsyncResult<>(Thread.currentThread().getName() + " " + text);
216+
return CompletableFuture.completedFuture(Thread.currentThread().getName() + " " + text);
217217
}
218218

219219
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void handleTransportError(StompSession session, Throwable exception) {
192192
};
193193

194194
stompClient.setMessageConverter(new SimpleMessageConverter());
195-
stompClient.connect("ws://localhost:{port}/messaging", handler, this.context.getWebServer().getPort());
195+
stompClient.connectAsync("ws://localhost:{port}/messaging", handler, this.context.getWebServer().getPort());
196196

197197
if (!latch.await(30, TimeUnit.SECONDS)) {
198198
if (failure.get() != null) {

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.Map;
3131
import java.util.Objects;
3232
import java.util.concurrent.Callable;
33+
import java.util.concurrent.CompletableFuture;
3334
import java.util.concurrent.CopyOnWriteArrayList;
3435
import java.util.concurrent.CountDownLatch;
3536
import java.util.concurrent.TimeUnit;
@@ -50,7 +51,6 @@
5051
import org.junit.jupiter.api.Test;
5152

5253
import org.springframework.http.HttpHeaders;
53-
import org.springframework.util.concurrent.ListenableFuture;
5454
import org.springframework.web.client.RestTemplate;
5555
import org.springframework.web.socket.CloseStatus;
5656
import org.springframework.web.socket.PingMessage;
@@ -165,7 +165,7 @@ private LiveReloadWebSocketHandler connect(Function<WebSocketContainer, WebSocke
165165
WsWebSocketContainer webSocketContainer = new WsWebSocketContainer();
166166
WebSocketClient client = clientFactory.apply(webSocketContainer);
167167
LiveReloadWebSocketHandler handler = new LiveReloadWebSocketHandler();
168-
client.doHandshake(handler, "ws://localhost:" + this.port + "/livereload");
168+
client.execute(handler, "ws://localhost:" + this.port + "/livereload");
169169
handler.awaitHello();
170170
return handler;
171171
}
@@ -293,7 +293,7 @@ static class UppercaseWebSocketClient extends StandardWebSocketClient {
293293
}
294294

295295
@Override
296-
protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler,
296+
protected CompletableFuture<WebSocketSession> executeInternal(WebSocketHandler webSocketHandler,
297297
HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions,
298298
Map<String, Object> attributes) {
299299
InetSocketAddress localAddress = new InetSocketAddress(getLocalHost(), uri.getPort());
@@ -311,7 +311,7 @@ protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandle
311311
this.webSocketContainer.connectToServer(endpoint, endpointConfig, uri);
312312
return session;
313313
};
314-
return getTaskExecutor().submitListenable(connectTask);
314+
return getTaskExecutor().submitCompletable(connectTask);
315315
}
316316

317317
private InetAddress getLocalHost() {

0 commit comments

Comments
 (0)