Skip to content

Commit 7b791d2

Browse files
committed
DATACMNS-748 - Fixed Spring 4.2 detection in QueryExecutionConverters.
Replaced the unreliable usage of SpringVersion.getVersion() with a dedicated lookup for a type only present in Spring 4.2.
1 parent 1befa52 commit 7b791d2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
import java.util.concurrent.CompletableFuture;
2222
import java.util.concurrent.Future;
2323

24-
import org.springframework.core.SpringVersion;
2524
import org.springframework.core.convert.ConversionService;
2625
import org.springframework.core.convert.TypeDescriptor;
2726
import org.springframework.core.convert.converter.Converter;
2827
import org.springframework.core.convert.converter.GenericConverter;
2928
import org.springframework.core.convert.support.ConfigurableConversionService;
30-
import org.springframework.data.util.Version;
3129
import org.springframework.scheduling.annotation.AsyncResult;
3230
import org.springframework.util.Assert;
3331
import org.springframework.util.ClassUtils;
@@ -44,8 +42,9 @@
4442
*/
4543
public abstract class QueryExecutionConverters {
4644

47-
private static final Version SPRING_VERSION = Version.parse(SpringVersion.getVersion());
48-
private static final Version FOUR_DOT_TWO = new Version(4, 2);
45+
private static final boolean SPRING_4_2_PRESENT = ClassUtils.isPresent(
46+
"org.springframework.core.annotation.AnnotationConfigurationException",
47+
QueryExecutionConverters.class.getClassLoader());
4948

5049
private static final boolean GUAVA_PRESENT = ClassUtils.isPresent("com.google.common.base.Optional",
5150
QueryExecutionConverters.class.getClassLoader());
@@ -67,7 +66,7 @@ public abstract class QueryExecutionConverters {
6766
WRAPPER_TYPES.add(NullableWrapperToJdk8OptionalConverter.getWrapperType());
6867
}
6968

70-
if (JDK_8_PRESENT && SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO)) {
69+
if (JDK_8_PRESENT && SPRING_4_2_PRESENT) {
7170
WRAPPER_TYPES.add(NullableWrapperToCompletableFutureConverter.getWrapperType());
7271
}
7372
}

0 commit comments

Comments
 (0)