@GetMapping: Spring Web’s annotation to indicate that this will serve HTTP GET /hypermedia/employee/{key} methods.
The return type is Mono
linkTo(): Spring HATEOAS’s static helper function to extract a link from a Spring WebFlux method invocation.
methodOn(): Spring HATEOAS’s static helper function to perform a dummy invocation of a controller’s web method to gather information for building links. In the first usage, we are pointing at the employee(String key) method of HypermediaController. In the second usage, we are pointing at the employees() method of HypermediaController (not yet written).
withSelfRel(): Spring HATEOAS’s method to label selfLink with a self hypermedia relation (which we’ll see shortly).
withRel(LinkRelation.of("employees")): Spring HATEOAS’s method to apply an arbitrary employees hypermedia relation.
toMono(): Spring HATEOAS’s method to take all the link-building settings and turn them into a Mono.
Mono.zip(): Reactor’s operator to combine two Mono operations and process the results when both are complete. There are other utilities for bigger sets, but waiting for two is so common that zip() is kind of a shortcut.
links.map(): We map over Tuple2 of the Mono object, extracting the links and bundling them with the fetched employee into a Spring HATEOAS EntityModel object.