Springboot application property with placeholder which is updated dynamically inside app

@Value("${url.fetch.data.with.id}")
String dataUrl;

String makeUrl(String id) {
  return UriComponentsBuilder.fromHttpUrl(dataUrl).buildAndExpand(id).toString();   
}

using the above code, if the URL has multiple placeholdets, add the values to be substituted in order.

url.fetch.data.with.id=http://localhost:8080/data/{ID}/details/{detailed}?startDate={startDate}&end={endDate}
long startDate = java.time.Instant.now().toEpochMilliSeconds();
long EndDate = java.time.Instant.now().toEpochMilliSeconds();
String detailedId = "abc";

String makeUrl(String id) {
  return UriComponentsBuilder.fromHttpUrl(dataUrl).buildAndExpand(id,detailedId,startDate,EndDate).toString();   
}