From 29065e9a15008191c706063a2a0eec57178cae85 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 17 Aug 2017 18:42:01 +0200 Subject: [PATCH] Added description of how to use Traverson with Sleuth fixes #671 --- docs/src/main/asciidoc/spring-cloud-sleuth.adoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/src/main/asciidoc/spring-cloud-sleuth.adoc b/docs/src/main/asciidoc/spring-cloud-sleuth.adoc index 8fe28228a..576d84db0 100644 --- a/docs/src/main/asciidoc/spring-cloud-sleuth.adoc +++ b/docs/src/main/asciidoc/spring-cloud-sleuth.adoc @@ -714,6 +714,22 @@ can see an example of how to set up such a custom `AsyncRestTemplate`. include::../../../../spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/MultipleAsyncRestTemplateTests.java[tags=custom_async_rest_template,indent=0] ---- +==== Traverson + +If you're using the http://docs.spring.io/spring-hateoas/docs/current/reference/html/#client.traverson[Traverson] library +it's enough for you to inject a `RestTemplate` as a bean into your Traverson object. Since `RestTemplate` +is already intercepted, you will get full support of tracing in your client. Below you can find a pseudo code +of how to do that: + +[source,java] +---- +@Autowired RestTemplate restTemplate; + +Traverson traverson = new Traverson(URI.create("http://some/address"), + MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON_UTF8).setRestOperations(restTemplate); +// use Traverson +---- + === Feign By default Spring Cloud Sleuth provides integration with feign via the `TraceFeignClientAutoConfiguration`. You can disable it entirely