You have do this:
RestClient rest = RestClient
.builder(builder.setConnectTimeout(Duration.ofSeconds(30))
.setReadTimeout(Duration.ofSeconds(30))
.rootUri("https://example.com)
.build())
.defaultHeader("Authorization", "Bearer " + properties.token())
.baseUrl("https://example.com")
.build();
If you only configure rootUri on the RestTemplateBuilder, it's ignored by RestClient.Builder as the built RestTemplate has a UriTemplateHandler that isn't a UriBuilderFactory. If you only configure baseUrl on the RestClient.Builder it's ignored as the UriBuilderFactory from the RestTemplate is used instead. Configuring both prevents the UriBuilderFactory from the RestTemplate from being used which then allows the baseUrl on the RestClient.Builder to be honored.