Skip to content

Instantly share code, notes, and snippets.

@bhawna94
Created May 14, 2019 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhawna94/0f66e1a50d4b1274fc8516b5a38ae5c5 to your computer and use it in GitHub Desktop.
Save bhawna94/0f66e1a50d4b1274fc8516b5a38ae5c5 to your computer and use it in GitHub Desktop.
public Mono<UserDetails> callToExternalService() {
return WebClient
.builder()
.baseUrl("https://jsonplaceholder.typicode.com")
.build()
.get()
.uri("posts/1")
.exchange()
.flatMap(clientResponse -> clientResponse.bodyToMono(UserDetails.class));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment