DATACMNS-1802 - Extract Flux.from(…) into own method.
For some reason, calling Flux.from(…) in its own, static method, heals NoClassDefFoundError even though the method is not used during runtime nor Publisher is defined in a method signature.
This commit is contained in:
@@ -179,7 +179,7 @@ abstract class RepositoryMethodInvoker {
|
||||
}
|
||||
|
||||
if (Collection.class.isAssignableFrom(returnedType)) {
|
||||
result = Flux.from(result).collectList();
|
||||
result = (Publisher<?>) collectToList(result);
|
||||
}
|
||||
|
||||
return AwaitKt.awaitFirstOrNull(result, continuation);
|
||||
@@ -189,6 +189,11 @@ abstract class RepositoryMethodInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
// to avoid NoClassDefFoundError: org/reactivestreams/Publisher when loading this class ¯\_(ツ)_/¯
|
||||
private static Object collectToList(Object result) {
|
||||
return Flux.from((Publisher<?>) result).collectList();
|
||||
}
|
||||
|
||||
private RepositoryMethodInvocation computeInvocationResult(RepositoryMethodInvocationCaptor captured) {
|
||||
return new RepositoryMethodInvocation(captured.getRepositoryInterface(), method, captured.getCapturedResult(),
|
||||
captured.getDuration());
|
||||
|
||||
Reference in New Issue
Block a user