Regarding your updated answer to your question, using bodyToFlux
is unnecessarily inefficient and semantically doesn’t make much sense either as you don’t really want a stream of orders. What you want is simply to be able to parse the response as a list.
bodyToMono(List<AccountOrder>.class)
won’t work due to type erasure. You need to be able to retain the type at runtime, and Spring provides ParameterizedTypeReference
for that:
bodyToMono(new ParameterizedTypeReference<List<AccountOrder>>() {})