Skip to content

Commit 2b49079

Browse files
use springboot managed resttemplate (#202)
Adopt Spring Boot managed RestTemplate so distributed tracing (traceId) is automatically propagated through all REST calls Signed-off-by: Abdelsalem <[email protected]> Co-authored-by: benrejebmoh <[email protected]>
1 parent ba7ee54 commit 2b49079

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/gridsuite/securityanalysis/server/RestTemplateConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.powsybl.contingency.json.ContingencyJsonModule;
1414
import com.powsybl.loadflow.json.LoadFlowParametersJsonModule;
1515
import com.powsybl.security.json.SecurityAnalysisJsonModule;
16+
import org.springframework.boot.web.client.RestTemplateBuilder;
1617
import org.springframework.context.annotation.Bean;
1718
import org.springframework.context.annotation.Configuration;
1819
import org.springframework.http.converter.HttpMessageConverter;
@@ -24,8 +25,8 @@
2425
public class RestTemplateConfig {
2526

2627
@Bean
27-
public RestTemplate restTemplate() {
28-
final RestTemplate restTemplate = new RestTemplate();
28+
public RestTemplate restTemplate(RestTemplateBuilder builder) {
29+
final RestTemplate restTemplate = builder.build();
2930

3031
//find and replace Jackson message converter with our own
3132
for (int i = 0; i < restTemplate.getMessageConverters().size(); i++) {

0 commit comments

Comments
 (0)