Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-97593 add RestTemplate bean #2125

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,4 @@ drill {

tasks.preTagCommit.enabled = false
tasks.updateVersion.enabled = false
tasks.commitNewVersion.enabled = false
tasks.commitNewVersion.enabled = false
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.epam.ta.reportportal.core.configs;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
pbortnik marked this conversation as resolved.
Show resolved Hide resolved
public class RestTemplateConfig {

@Bean
RestTemplate restTemplate() {
return new RestTemplateBuilder()
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public class JobsHealthIndicator extends AbstractHealthIndicator {

private static Logger LOGGER = LoggerFactory.getLogger(JobsHealthIndicator.class);
private static final String ERROR_MESSAGE = "Jobs service health check failed";
RestTemplate restTemplate;
private final RestTemplate restTemplate;

@Value("${rp.jobs.baseUrl}")
private String jobsBaseUrl;

public JobsHealthIndicator() {
public JobsHealthIndicator(RestTemplate restTemplate) {
super(ERROR_MESSAGE);
this.restTemplate = new RestTemplate();
this.restTemplate = restTemplate;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class JobsInfoContributor implements InfoContributor {
@Value("${rp.jobs.baseUrl}")
private String jobsBaseUrl;

public JobsInfoContributor() {
this.restTemplate = new RestTemplate();
public JobsInfoContributor(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}

@Override
Expand Down
Loading