Mark ListenableFuture as deprecated for removal
Closes gh-33808
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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,6 +16,7 @@
|
||||
|
||||
package example.scannable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -51,9 +52,8 @@ public class AutowiredQualifierFooService implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>(this.fooDao.findFoo(id));
|
||||
return CompletableFuture.completedFuture(this.fooDao.findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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,6 +18,7 @@ package example.scannable;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -91,10 +92,9 @@ public abstract class FooServiceImpl implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
Assert.state(ServiceInvocationCounter.getThreadLocalCount() != null, "Thread-local counter not exposed");
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>(fooDao().findFoo(id));
|
||||
return CompletableFuture.completedFuture(fooDao().findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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,6 +16,7 @@
|
||||
|
||||
package example.scannable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -33,9 +34,8 @@ public class ScopedProxyTestBean implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>("bar");
|
||||
return CompletableFuture.completedFuture("bar");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user