I need to invoke a rest service asynchronously and I thought of using spring reactive's webclient instead of the AsyncRestTemplate. However my url is not getting invoked at all with the below code.
Mono<Test> asyncResponse = webClientBuilder.build().post().uri(url).contentType(MediaType.APPLICATION_JSON)
.header("h1", h1).header("h2", h2)
.body(BodyInserters.fromObject(request))
.retrieve().bodyToMono(Test.class);
However if I do the same synchronously everything works fine.
webClientBuilder.build().post().uri(url).contentType(MediaType.APPLICATION_JSON)
.header("h1", h1).header("h2", h2)
.body(BodyInserters.fromObject(request))
.exchange();`
What am I doing wrong?