mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Adapt to deprecations in Spring Framework
See https://github.com/spring-projects/spring-framework/issues/27780
This commit is contained in:
parent
ac1203551c
commit
aac3ccf59c
@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.task;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Consumer;
|
||||
@ -37,7 +38,6 @@ import org.springframework.core.task.SyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskDecorator;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.AsyncResult;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
@ -213,7 +213,7 @@ class TaskExecutionAutoConfigurationTests {
|
||||
|
||||
@Async
|
||||
Future<String> echo(String text) {
|
||||
return new AsyncResult<>(Thread.currentThread().getName() + " " + text);
|
||||
return CompletableFuture.completedFuture(Thread.currentThread().getName() + " " + text);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class WebSocketMessagingAutoConfigurationTests {
|
||||
};
|
||||
|
||||
stompClient.setMessageConverter(new SimpleMessageConverter());
|
||||
stompClient.connect("ws://localhost:{port}/messaging", handler, this.context.getWebServer().getPort());
|
||||
stompClient.connectAsync("ws://localhost:{port}/messaging", handler, this.context.getWebServer().getPort());
|
||||
|
||||
if (!latch.await(30, TimeUnit.SECONDS)) {
|
||||
if (failure.get() != null) {
|
||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -50,7 +51,6 @@ import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.PingMessage;
|
||||
@ -165,7 +165,7 @@ class LiveReloadServerTests {
|
||||
WsWebSocketContainer webSocketContainer = new WsWebSocketContainer();
|
||||
WebSocketClient client = clientFactory.apply(webSocketContainer);
|
||||
LiveReloadWebSocketHandler handler = new LiveReloadWebSocketHandler();
|
||||
client.doHandshake(handler, "ws://localhost:" + this.port + "/livereload");
|
||||
client.execute(handler, "ws://localhost:" + this.port + "/livereload");
|
||||
handler.awaitHello();
|
||||
return handler;
|
||||
}
|
||||
@ -293,7 +293,7 @@ class LiveReloadServerTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler,
|
||||
protected CompletableFuture<WebSocketSession> executeInternal(WebSocketHandler webSocketHandler,
|
||||
HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions,
|
||||
Map<String, Object> attributes) {
|
||||
InetSocketAddress localAddress = new InetSocketAddress(getLocalHost(), uri.getPort());
|
||||
@ -311,7 +311,7 @@ class LiveReloadServerTests {
|
||||
this.webSocketContainer.connectToServer(endpoint, endpointConfig, uri);
|
||||
return session;
|
||||
};
|
||||
return getTaskExecutor().submitListenable(connectTask);
|
||||
return getTaskExecutor().submitCompletable(connectTask);
|
||||
}
|
||||
|
||||
private InetAddress getLocalHost() {
|
||||
|
Loading…
Reference in New Issue
Block a user