In this section, we will go into a bit more detail on Spring WebFlux. There are two (programming model) ways by which Spring WebFlux can be used. They are as follows:
The following code shows the annotation-based style of using Spring WebFlux. We will be going through the entire code sample in subsequent sections in this chapter. This section, however, is aimed at giving an introduction before we delve deeper:
@RestController @RequestMapping(value=”/api/movie”) public class MovieAPI { @GetMapping(“/”) public Flux(Movie) getMovies() { //Logic of getting all movies } @GetMapping(“/{id}”) public Mono<Movie> getMovie(@PathVariable Long id) { //Logic for getting a specific movie } @PostMapping(“/post”) public Mono<ResponseEntity<String>> createMovie...