DATACMNS-1762 - Consider reactive types as wrappers during method introspection.

We now perform type unwrapping and introspection for reactive types for method return types and method arguments after decoupling QueryExecutionConverters.supports(…) from ReactiveWrapperConverters.
This commit is contained in:
Mark Paluch
2020-09-25 14:41:54 +02:00
parent f261220372
commit 5876bd2e5a
2 changed files with 7 additions and 3 deletions

View File

@@ -113,7 +113,8 @@ public abstract class AbstractRepositoryMetadata implements RepositoryMetadata {
return ReactiveWrapperConverters.unwrapWrapperTypes(returnType).getType();
}
return QueryExecutionConverters.unwrapWrapperTypes(returnType).getType();
return ReactiveWrapperConverters.unwrapWrapperTypes(QueryExecutionConverters.unwrapWrapperTypes(returnType))
.getType();
}
/*

View File

@@ -30,6 +30,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.util.ClassUtils;
import org.springframework.data.repository.util.QueryExecutionConverters;
import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.TypeInformation;
@@ -228,7 +229,8 @@ public class Parameter {
TypeInformation<?> bound = parameterTypes.getTypeArguments().get(0);
TypeInformation<Object> returnType = ClassTypeInformation.fromReturnTypeOf(method);
return bound.equals(QueryExecutionConverters.unwrapWrapperTypes(returnType));
return bound
.equals(ReactiveWrapperConverters.unwrapWrapperTypes(QueryExecutionConverters.unwrapWrapperTypes(returnType)));
}
/**
@@ -239,7 +241,8 @@ public class Parameter {
* @see QueryExecutionConverters
*/
private static boolean isWrapped(MethodParameter parameter) {
return QueryExecutionConverters.supports(parameter.getParameterType());
return QueryExecutionConverters.supports(parameter.getParameterType())
|| ReactiveWrapperConverters.supports(parameter.getParameterType());
}
/**