title: Returns a object from RouterFunction handlers in Spring 5 WebFlux
body: <p>I have the following bean definition for a RouterFunction:</p>
  
  <pre><code>@Bean
      RouterFunction&lt;?&gt; routes(DestinationHandler destinationHandler) {
  
          return nest(path("/destination"), route(method(GET), destinationHandler::findAll));
  
      }
  </code></pre>
  
  <p>And this the handler function:</p>
  
  <pre><code>public Mono&lt;ServerResponse&gt; findAll(ServerRequest request) {
      Flux&lt;Destination&gt; destinations = destinationService.findAll();
  
      ResponseData responseData = buildResponseData(destinations);
  
      return ok().body(Mono.just(responseData), ResponseData.class);
  
  }
  
  private ResponseData buildResponseData(Flux&lt;Destination&gt; destinations) {
      ResponseData responseData = new ResponseData();
      responseData.setStatus(HttpStatus.OK.value());
      responseData.setCode(DESTINATION_LIST_SUCCESS_CODE);
      responseData.setMessage(DESTINATION_LIST_SUCCESS_MESSAGE);
      responseData.setData(destinations);
      return responseData;
  }
  </code></pre>
  
  <p>And my ResponseData:</p>
  
  <pre><code>@Data
  @AllArgsConstructor
  @NoArgsConstructor
  public class ResponseData {
      private int status;
      private String code;
      private String message;
      private Object data;
  }
  </code></pre>
  
  <p>Destination class:</p>
  
  <pre><code>//lombok annotations
  public class Destination {
      private int id;
      private String local;
  }
  </code></pre>
  
  <p>This result in this:</p>
  
  <p>{<br>
     "status":200,
     "code":"destination_list_success",
     "message":"Retorno realizado com sucesso",
     "data":{<br>
        "scanAvailable":true,
        "prefetch":-1
     }
  }</p>
  
  <p>How can I return the correct destination list?</p>