Created
July 1, 2019 07:37
-
-
Save deepakmehra10/9a053a744f32a4a1e0c2b27bf5615b69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class ContentServiceImpl implements ContentService { | |
private static final Logger LOGGER = Logger.getLogger(ContentServiceImpl.class.getName()); | |
private final WebClient webClient; | |
public ContentServiceImpl(@Value("${content-service}") String baseURL) { | |
this.webClient = WebClient.builder().baseUrl(baseURL) | |
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE) | |
.filter(logRequest()) | |
.build(); | |
} | |
@Override | |
public Mono<Post> getPost(int id) { | |
return webClient.get().uri("posts/{id}", id).retrieve().bodyToMono(Post.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment