title: Getting a list of JSON Users objs. in a POST request and return a response also as JSON
body: <p>This is my first time using spring-webflux with SpringBoot. My goal is to create an API that accepts a list of Users in JSON format in the body of a POST and return a response with that list also in JSON format ordered by a date field. The ordering is not a problem but I do not know very well how to make this architecture. So far I have:</p>
  <ul>
  <li><p>UserWebfluxApplication (with the @SpringBootApplication)</p>
  </li>
  <li><p>model/User.java (id, name, surname, creationDate)</p>
  </li>
  <li><p>service/UserService.java (Interface)</p>
  </li>
  <li><p>service/UserServiceImpl.java implementing the Interface with the WebClient and with the following method:</p>
  <pre><code>  @Override
    public List&lt;User&gt; processUserDataFromUserList() {
            Mono&lt;List&lt;User&gt;&gt; response = webClient.get()
            .accept(MediaType.APPLICATION_JSON)
            .retrieve()
            .bodyToMono(new ParameterizedTypeReference&lt;List&lt;User&gt;&gt;() {});
  
            List&lt;User&gt; users = response.block();
  
            return users .stream()
            .sorted(Comparator.comparing(User::getCreatedTime))
            .collect(Collectors.toList());
    }
  </code></pre>
  </li>
  <li><p>controller/UserController.java (Here I don't know how can I construct this class for reach my achievement testing the request for example with curl, Postman, or whatever). So far I've this in the UserController:</p>
  <pre><code>  @RestController
    public class UserController {
  
        @Autowired
        private UserService userService;
  
        @PostMapping(value = {&quot;/readUser&quot;})
        @ResponseStatus(HttpStatus.OK)
        public void readUser(@RequestBody List&lt;User&gt; users) {
            userService.processUserDataFromUserList();
        }
  
    }
  </code></pre>
  </li>
  </ul>
  <p>The json request will be like:</p>
  <pre><code>  {
      &quot;id&quot;: 951,
      &quot;name&quot;: &quot;Marco&quot;,
      &quot;surname&quot;: &quot;Polo&quot;,
      &quot;creationDate&quot;: &quot;2021-01-23T02:36:09-08:00&quot;
    },
    {
      &quot;id&quot;: 952,
      &quot;name&quot;: &quot;Estela&quot;,
      &quot;surname&quot;: &quot;Star&quot;,
      &quot;creationDate&quot;: &quot;2021-01-14T18:30:09-07:00&quot;
    },
    {
      &quot;id&quot;: 953,
      &quot;name&quot;: &quot;Jim&quot;,
      &quot;surname&quot;: &quot;Pask&quot;,
      &quot;creationDate&quot;: &quot;2021-01-02T08:22:12+05:00&quot;
    },
    {
      &quot;id&quot;: 954,
      &quot;name&quot;: &quot;Lorena&quot;,
      &quot;surname&quot;: &quot;Cubo&quot;,
      &quot;creationDate&quot;: &quot;2021-02-15T01:01:32-02:00&quot;
    }
  </code></pre>
  <p>Thank you in advance.</p>