title: HATEOAS on Spring Flux/Mono response
body: <p>I've been using Spring HATEOAS following the guidelines:</p>
  
  <p><a href="https://spring.io/guides/gs/rest-hateoas/#initial" rel="noreferrer">https://spring.io/guides/gs/rest-hateoas/#initial</a></p>
  
  <pre><code>package hello;
  
  import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*;
  
  import org.springframework.http.HttpEntity;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  
  @RestController
  public class GreetingController {
  
      private static final String TEMPLATE = "Hello, %s!";
  
      @RequestMapping("/greeting")
      public HttpEntity&lt;Greeting&gt; greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name) {
  
          Greeting greeting = new Greeting(String.format(TEMPLATE, name));
          greeting.add(linkTo(methodOn(GreetingController.class).greeting(name)).withSelfRel());
  
          return new ResponseEntity&lt;Greeting&gt;(greeting, HttpStatus.OK);
      }
  }
  </code></pre>
  
  <p>Now I want to use a repository and output a Flux/Mono response:</p>
  
  <pre><code>@RestController
  class PersonController {
  
      private final PersonRepository people;
  
      public PersonController(PersonRepository people) {
          this.people = people;
      }
  
      @GetMapping("/people")
      Flux&lt;String&gt; namesByLastname(@RequestParam Mono&lt;String&gt; lastname) {
  
          Flux&lt;Person&gt; result = repository.findByLastname(lastname);
          return result.map(it -&gt; it.getFullName());
      }
  }
  </code></pre>
  
  <p>How can I use Spring HATEOAS on a Flux/Mono response? Is it possible at all?</p>