It would be nice that defaultUriVariables()
could accept Supplier
/Function
as value of Map.
MDC.put("partition", "p0"); // value is variable per request
Map<String, ?> defaultUriVariables = Map.of(
// "partition", (Supplier<String>) () -> MDC.get("partition"),
"partition", (Function<String, String>) MDC::get
);
RestClient restClient = RestClient.builder().baseUrl("http://{partition}.example.com").defaultUriVariables(defaultUriVariables).build();
Comment From: snicoll
Duplicate of #34190