diff --git a/src/main/java/org/example/githubservice/service/impl/GithubServiceImpl.java b/src/main/java/org/example/githubservice/service/impl/GithubServiceImpl.java index 456e2fe..ee8042d 100644 --- a/src/main/java/org/example/githubservice/service/impl/GithubServiceImpl.java +++ b/src/main/java/org/example/githubservice/service/impl/GithubServiceImpl.java @@ -3,6 +3,7 @@ import org.example.githubservice.model.dtos.BranchDTO; import org.example.githubservice.model.dtos.RepositoryDTO; import org.example.githubservice.service.api.GithubService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -18,8 +19,8 @@ public class GithubServiceImpl implements GithubService { private final String REPOS_OF_USER = "/users/{username}/repos"; private final WebClient webClient; - public GithubServiceImpl() { - this.webClient = WebClient.create("https://api.github.com"); + public GithubServiceImpl(WebClient.Builder webClientBuilder, @Value("${github.api.base-url}") String rootUrl) { + this.webClient = webClientBuilder.baseUrl(rootUrl).build(); } @Override diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b13789..2eb6a5b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1 @@ - +github.api.base-url=https://api.github.com