Skip to content

Commit

Permalink
create default restclient
Browse files Browse the repository at this point in the history
  • Loading branch information
hknots committed Nov 22, 2024
1 parent 1eaf33c commit 1ae07c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/no/fint/oauth/TokenService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,7 +26,7 @@ public class TokenService {
private final MultiValueMap<String, String> formData;
private AuthToken authToken;

public TokenService(OAuthTokenProps props, RestClient restClient) {
public TokenService(OAuthTokenProps props, @Qualifier("oauthRestClient") RestClient restClient) {
this.props = props;
this.restClient = restClient;
this.formData = createFormData();
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/no/fint/oauth/config/RestClientConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package no.fint.oauth.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;

@Configuration
public class RestClientConfig {

@Bean("oauthRestClient")
public RestClient oauthRestClient() {
return RestClient.builder().build();
}

}

0 comments on commit 1ae07c0

Please sign in to comment.