mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Add Mono and Flux support in @RequestMapping handler methods
This commit is contained in:
+7
@@ -76,7 +76,14 @@ public class RequestBodyArgumentResolver implements HandlerMethodArgumentResolve
|
||||
if (this.conversionService.canConvert(Publisher.class, type.getRawClass())) {
|
||||
return Mono.just(this.conversionService.convert(elementFlux, type.getRawClass()));
|
||||
}
|
||||
else if (type.getRawClass() == Flux.class) {
|
||||
return Mono.just(elementFlux);
|
||||
}
|
||||
else if (type.getRawClass() == Mono.class) {
|
||||
return Mono.just(Mono.from(elementFlux));
|
||||
}
|
||||
|
||||
// TODO Currently manage only "Foo" parameter, not "List<Foo>" parameters, Stéphane is going to add toIterable/toIterator to Flux to support that use case
|
||||
return elementFlux.next().map(o -> o);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user