I have a basic SpringBoot 3.3.4 app and I use RestClient to replace RestTemplate. I try to create RestTemplate and RestTemplate like this

    @Bean
    RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder.build();
    }

    @Bean
    RestClient restClient() {
        return RestClient.builder().build();
    }

I can see that the request headers are injected before the request execute, but this does not work when I use RestClient.

Comment From: bclozel

You will need to inject a builder for RestClient as well if you want the auto-configured observability. See https://docs.spring.io/spring-boot/reference/io/rest-client.html#io.rest-client.restclient.customization

For further guidance please use StackOverflow.