Spring Boot Reactive WebFlux
Reactive Programming
Non-blocking reactive web applications.
WebFlux Controller
@RestController
public class ReactiveController {
@GetMapping("/products")
public Flux getProducts() {
return productService.findAll();
}
@GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux streamEvents() {
return Flux.interval(Duration.ofSeconds(1))
.map(i - ServerSentEvent.builder("data").build());
}
} Reactive Stack
- R2DBC (reactive database)
- Reactive Redis/Mongo
- WebClient (HTTP client)
- Reactive security