Imagine that we test a Payment service. In this scenario, suppose that the Payment service supports the GET and POST methods for the /payments endpoint. The first HTTP call is responsible for retrieving the list of executed payments for the current user. In turn, the second makes it possible to submit a new payment. Implementation of that rest controller looks like the following:
@RestController @RequestMapping("/payments") public class PaymentController { private final PaymentService paymentService; public PaymentController(PaymentService paymentService) { this.paymentService = paymentService; } @GetMapping("/") public Flux<Payment> list() { return paymentService.list(); } @PostMapping("/") public ...