org.springframework.web.reactive.function.server.support.ServerResponseResultHandler.java can NOT handle Mono<ServerResponse> or Flux<ServerResponse>.
public boolean supports(HandlerResult result) always return false.
because it check a returnValue type of HandlerResult .
need to replace a return type with a generic type of it.
see below error code.
@Override
public boolean supports(HandlerResult result) {
return (result.getReturnValue() instanceof ServerResponse);
}
fix like below it has to compare with a generic type of returnType
@Override
public boolean supports(HandlerResult result) {
return ServerResponse.class.isAssignableFrom(result.getReturnType().getGeneric().toClass());
}
Related: https://github.com/spring-projects/spring-framework/issues/27266
Comment From: ascopes
should this use .toClass().isAssignableFrom or .equals rather than class instance identity? (could see situations where this may be problematic in environments that use OSGi, for example).
Comment From: hongjunan
should this use
.toClass().isAssignableFromor.equalsrather than class instance identity? (could see situations where this may be problematic in environments that use OSGi, for example).
Totally agree with your comment. i fixed it. thank you.
Comment From: rstoyanchev
We don't need both an issue and a PR, and typically, the issue is closed, but in this case the conversation is under way on the issue, and the PR is trivial. It can always be re-opened.