title: Spring boot return 204 No-Content when List is empty
body: <p>I have a controller that should return <code>204-No Content</code> when no element exists in the list returned by the repository. In Spring when I return an empty list, the response status is <code>200-OK</code>. I found a way to solve this setting my controller to return a <code>Response Entity</code>, but there is another way of doing this? I don't want to throw a exception, since a empty list in my use case makes sense, and can't use <code>@ResponseStatus</code> because in the use case the list can have elements too and so I need to return <code>200-OK</code> and the list.</p>
  
  <p>I solved using this approach, but I want to return a <code>List&lt;Parcela&gt;</code> in my controller and <code>204-No content</code></p>
  
  <pre><code>@GetMapping(path = "/contratos/{numeroContrato}/parcelas", params = "status")
  ResponseEntity&lt;List&lt;Parcela&gt;&gt; filtrarParcelasPorStatus(@PathVariable String documento,
          @PathVariable String numeroContrato, @RequestParam StatusParcela status) {
      try {
          List&lt;Parcela&gt; parcelasFiltradas = veiculosUsecase.filtrarParcelasPorStatus(documento, numeroContrato,
                  status);
          if (parcelasFiltradas.isEmpty()) {
              return new ResponseEntity&lt;&gt;(HttpStatus.NO_CONTENT);
          }
          return new ResponseEntity&lt;&gt;(parcelasFiltradas, HttpStatus.OK);
      }
      catch (ParcelasNaoEncontradasException e) {
          throw new NotFoundException(
                  "Nao e possivel listar as parcelas porque nao foi encontrado o contrato para o numero de contrato e cliente informado",
                  "Nao e possivel listar as parcelas porque nao foi encontrado o contrato para o numero de contrato e cliente informado",
                  HttpStatus.NOT_FOUND.toString(), "External - Veiculos API");
      }
  }
  </code></pre>