At backend side I have REST controller with POST method:
@RequestMapping(value = "/save", method = RequestMethod.POST)
public Integer save(@RequestParam String name) {
   //do save
   return 0;
}
How can I create request using WebClient with request parameter?
WebClient.create(url).post()
    .uri("/save")
    //?
    .exchange()
    .block()
    .bodyToMono(Integer.class)
    .block();
                There are many encoding challenges when it comes to creating URIs. For more flexibility while still being right on the encoding part, WebClient provides a builder-based variant for the URI:
WebClient.create().get()
    .uri(builder -> builder.scheme("http")
                    .host("example.org").path("save")
                    .queryParam("name", "spring-framework")
                    .build())
    .retrieve()
    .bodyToMono(String.class);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With