Fix generics for customizeMonoReply()
Related to: https://stackoverflow.com/questions/68637283/how-to-customize-response-in-spring-integration-using-webflux-when-a-specific-er The function provided for the `ConsumerEndpointSpec.customizeMonoReply()` may convert incoming value to something else. With wildcards it cannot be compiled without casting. * Add `<T, V>` generic arg for the `customizeMonoReply()` to conform in and out types carrying. * Modify `WebFluxDslTests` to demonstrate the problem and confirm the fix **Cherry-pick to `5.4.x` & `5.3.x`**
This commit is contained in:
committed by
Gary Russell
parent
b949b90d66
commit
024ffd1423
@@ -223,12 +223,16 @@ public abstract class ConsumerEndpointSpec<S extends ConsumerEndpointSpec<S, H>,
|
||||
/**
|
||||
* Specify a {@link BiFunction} for customizing {@link Mono} replies via {@link ReactiveRequestHandlerAdvice}.
|
||||
* @param replyCustomizer the {@link BiFunction} to propagate into {@link ReactiveRequestHandlerAdvice}.
|
||||
* @param <T> inbound reply payload.
|
||||
* @param <V> outbound reply payload.
|
||||
* @return the spec.
|
||||
* @since 5.3
|
||||
* @see ReactiveRequestHandlerAdvice
|
||||
*/
|
||||
public S customizeMonoReply(BiFunction<Message<?>, Mono<?>, Publisher<?>> replyCustomizer) {
|
||||
return advice(new ReactiveRequestHandlerAdvice(replyCustomizer));
|
||||
@SuppressWarnings({ "unchecked", "rawtypes"})
|
||||
public <T, V> S customizeMonoReply(BiFunction<Message<?>, Mono<T>, Publisher<V>> replyCustomizer) {
|
||||
return advice(new ReactiveRequestHandlerAdvice(
|
||||
(BiFunction<Message<?>, Mono<?>, Publisher<?>>) (BiFunction) replyCustomizer));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user