Skip to content

Commit

Permalink
Remove ListenableFuture support.
Browse files Browse the repository at this point in the history
Closes #3232
  • Loading branch information
mp911de committed Jan 14, 2025
1 parent 18d66a4 commit 6ac6de2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
* @author John Blum
* @author Johannes Englmeier
*/
@SuppressWarnings("removal")
public abstract class RepositoryFactorySupport
implements BeanClassLoaderAware, BeanFactoryAware, EnvironmentAware, EnvironmentCapable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,21 @@
import org.springframework.data.util.Streamable;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.util.ObjectUtils;
import org.springframework.util.concurrent.ListenableFuture;

/**
* Converters to potentially wrap the execution of a repository method into a variety of wrapper types potentially being
* available on the classpath. Currently supported:
* <ul>
* <li>{@code java.util.concurrent.Future}</li>
* <li>{@code java.util.concurrent.CompletableFuture}</li>
* <li>{@code org.springframework.util.concurrent.ListenableFuture<}</li>
* <li>{@code javaslang.collection.Seq}, {@code javaslang.collection.Map}, {@code javaslang.collection.Set} - as of
* 1.13</li>
* <li>{@code io.vavr.collection.Seq}, {@code io.vavr.collection.Map}, {@code io.vavr.collection.Set} - as of 2.0</li>
* <li>{@code javaslang.collection.Seq}, {@code javaslang.collection.Map}, {@code javaslang.collection.Set} - as of 1.13
* via {@link CustomCollections}</li>
* <li>{@code io.vavr.collection.Seq}, {@code io.vavr.collection.Map}, {@code io.vavr.collection.Set} - as of 2.0 via
* {@link CustomCollections}</li>
* <li>Reactive wrappers supported by {@link org.springframework.data.util.ReactiveWrappers} - as of 2.0</li>
* </ul>
*
Expand All @@ -74,7 +72,6 @@
* @since 1.8
* @see NullableWrapperConverters
*/
@SuppressWarnings("removal")
public abstract class QueryExecutionConverters {

private static final boolean VAVR_PRESENT = ClassUtils.isPresent("io.vavr.control.Try",
Expand All @@ -92,9 +89,7 @@ public abstract class QueryExecutionConverters {

WRAPPER_TYPES.add(WrapperType.singleValue(Future.class));
UNWRAPPER_TYPES.add(WrapperType.singleValue(Future.class));
WRAPPER_TYPES.add(WrapperType.singleValue(ListenableFuture.class));
WRAPPER_TYPES.add(WrapperType.singleValue(CompletableFuture.class));
UNWRAPPER_TYPES.add(WrapperType.singleValue(ListenableFuture.class));
UNWRAPPER_TYPES.add(WrapperType.singleValue(CompletableFuture.class));

ALLOWED_PAGEABLE_TYPES.add(Slice.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,6 @@ void wrapsExecutionResultIntoCompletableFutureIfConfigured() throws Exception {
expect(prepareConvertingRepository(reference).findOneByFirstname("Foo"), reference);
}

@Test // DATACMNS-714
void wrapsExecutionResultIntoListenableFutureIfConfigured() throws Exception {

var reference = new User();

expect(prepareConvertingRepository(reference).findOneByLastname("Foo"), reference);
}

@Test // DATACMNS-714
void wrapsExecutionResultIntoCompletableFutureWithEntityCollectionIfConfigured() throws Exception {

Expand Down Expand Up @@ -605,7 +597,6 @@ interface AnnotatedRepository {

}

@SuppressWarnings("removal")
interface ConvertingRepository extends Repository<Object, Long> {

Set<String> convertListToStringSet();
Expand All @@ -625,10 +616,6 @@ interface ConvertingRepository extends Repository<Object, Long> {
@Async
CompletableFuture<List<User>> readAllByFirstname(String firstname);

// DATACMNS-714
@Async
CompletableFuture<User> findOneByLastname(String lastname);

// DATACMNS-714
@Async
CompletableFuture<List<User>> readAllByLastname(String lastname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.springframework.data.util.NullableWrapper;
import org.springframework.data.util.Streamable;
import org.springframework.data.util.TypeInformation;
import org.springframework.util.concurrent.ListenableFuture;

import com.google.common.base.Optional;

Expand All @@ -57,7 +56,6 @@
* @author Maciek Opała
* @author Johannes Englmeier
*/
@SuppressWarnings("removal")
class QueryExecutionConvertersUnitTests {

DefaultConversionService conversionService;
Expand All @@ -75,7 +73,6 @@ void registersWrapperTypes() {
assertThat(QueryExecutionConverters.supports(Optional.class)).isTrue();
assertThat(QueryExecutionConverters.supports(java.util.Optional.class)).isTrue();
assertThat(QueryExecutionConverters.supports(Future.class)).isTrue();
assertThat(QueryExecutionConverters.supports(ListenableFuture.class)).isTrue();
assertThat(QueryExecutionConverters.supports(CompletableFuture.class)).isTrue();
assertThat(QueryExecutionConverters.supports(Option.class)).isTrue();
assertThat(QueryExecutionConverters.supports(io.vavr.control.Option.class)).isTrue();
Expand All @@ -88,7 +85,6 @@ void registersUnwrapperTypes() {
assertThat(QueryExecutionConverters.supportsUnwrapping(java.util.Optional.class)).isTrue();
assertThat(QueryExecutionConverters.supportsUnwrapping(Future.class)).isTrue();
assertThat(QueryExecutionConverters.supportsUnwrapping(CompletableFuture.class)).isTrue();
assertThat(QueryExecutionConverters.supportsUnwrapping(ListenableFuture.class)).isTrue();
assertThat(QueryExecutionConverters.supportsUnwrapping(Option.class)).isTrue();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.util.concurrent.ListenableFuture;

import com.google.common.base.Optional;

Expand All @@ -36,7 +35,6 @@
* @author Mark Paluch
* @author Maciek Opała
*/
@SuppressWarnings("removal")
class NullableWrapperConvertersUnitTests {

DefaultConversionService conversionService;
Expand All @@ -54,7 +52,6 @@ void registersWrapperTypes() {
assertThat(NullableWrapperConverters.supports(Optional.class)).isTrue();
assertThat(NullableWrapperConverters.supports(java.util.Optional.class)).isTrue();
assertThat(NullableWrapperConverters.supports(Future.class)).isFalse();
assertThat(NullableWrapperConverters.supports(ListenableFuture.class)).isFalse();
assertThat(NullableWrapperConverters.supports(CompletableFuture.class)).isFalse();
assertThat(NullableWrapperConverters.supports(Option.class)).isTrue();
assertThat(NullableWrapperConverters.supports(io.vavr.control.Option.class)).isTrue();
Expand All @@ -66,7 +63,6 @@ void registersUnwrapperTypes() {
assertThat(NullableWrapperConverters.supportsUnwrapping(Optional.class)).isTrue();
assertThat(NullableWrapperConverters.supportsUnwrapping(java.util.Optional.class)).isTrue();
assertThat(NullableWrapperConverters.supportsUnwrapping(Future.class)).isFalse();
assertThat(NullableWrapperConverters.supportsUnwrapping(ListenableFuture.class)).isFalse();
assertThat(NullableWrapperConverters.supportsUnwrapping(CompletableFuture.class)).isFalse();
assertThat(NullableWrapperConverters.supportsUnwrapping(Option.class)).isTrue();
}
Expand Down

0 comments on commit 6ac6de2

Please sign in to comment.