27
27
28
28
import org .springframework .core .MethodParameter ;
29
29
import org .springframework .core .convert .ConversionService ;
30
- import org .springframework .core .convert .support .DefaultConversionService ;
31
30
import org .springframework .data .repository .core .RepositoryInformation ;
32
31
import org .springframework .data .repository .core .RepositoryMetadata ;
33
32
import org .springframework .data .repository .util .QueryExecutionConverters ;
34
33
import org .springframework .data .repository .util .ReactiveWrapperConverters ;
34
+ import org .springframework .data .repository .util .ReactiveWrappers ;
35
35
import org .springframework .util .Assert ;
36
36
37
37
/**
@@ -110,7 +110,7 @@ static boolean isNonUnwrappingWrapper(Class<?> parameterType) {
110
110
111
111
/**
112
112
* Returns whether the given {@link Method} uses a reactive wrapper type as parameter.
113
- *
113
+ *
114
114
* @param method must not be {@literal null}.
115
115
* @return
116
116
*/
@@ -125,7 +125,7 @@ private static boolean usesParametersWithReactiveWrappers(Method method) {
125
125
/**
126
126
* Returns a candidate method from the base class for the given one or the method given in the first place if none one
127
127
* the base class matches.
128
- *
128
+ *
129
129
* @param method must not be {@literal null}.
130
130
* @param baseClass must not be {@literal null}.
131
131
* @param predicate must not be {@literal null}.
@@ -189,8 +189,6 @@ private static boolean parametersMatch(Method method, Method baseClassMethod,
189
189
@ RequiredArgsConstructor (staticName = "of" )
190
190
static class WrapperConversionMatch implements BiPredicate <Class <?>, Integer > {
191
191
192
- private static final ConversionService CONVERSION_SERVICE = ReactiveWrapperConverters
193
- .registerConvertersIn (new DefaultConversionService ());
194
192
private final Class <?>[] declaredParameterTypes ;
195
193
196
194
/*
@@ -208,7 +206,8 @@ public boolean test(Class<?> candidateParameterType, Integer index) {
208
206
return false ;
209
207
}
210
208
211
- return CONVERSION_SERVICE .canConvert (declaredParameterTypes [index ], candidateParameterType );
209
+ return ReactiveWrappers .isAvailable ()
210
+ && ReactiveWrapperConverters .canConvert (declaredParameterTypes [index ], candidateParameterType );
212
211
}
213
212
}
214
213
@@ -244,7 +243,7 @@ public boolean test(Class<?> candidateParameterType, Integer index) {
244
243
/**
245
244
* {@link BiPredicate} to check parameter assignability between a parameters in which the declared parameter may be
246
245
* wrapped but supports unwrapping. Usually types like {@link java.util.Optional} or {@link java.util.stream.Stream}.
247
- *
246
+ *
248
247
* @see QueryExecutionConverters
249
248
*/
250
249
@ RequiredArgsConstructor (access = AccessLevel .PRIVATE )
0 commit comments