Skip to content

Commit

Permalink
Add qualifier to bean in case of reuse.
Browse files Browse the repository at this point in the history
  • Loading branch information
Asgeir Nilsen committed Aug 31, 2020
1 parent 5d9ff2b commit 1e9a6aa
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pipeline {
agent {
docker {
label 'docker'
image 'gradle:4.10.2-jdk8-alpine'
image 'gradle:4.10.3-jdk8-alpine'
}
}
stages {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions src/main/java/no/fint/oauth/OAuthConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.fint.oauth;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -20,6 +21,7 @@ public OAuthTokenProps props() {
}

@Bean
@Qualifier("fintOauthRestTemplate")
public OAuth2RestTemplate oauth2RestTemplate() {
OAuthTokenProps props = props();
ResourceOwnerPasswordResourceDetails resourceDetails = new ResourceOwnerPasswordResourceDetails();
Expand Down
2 changes: 2 additions & 0 deletions 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
Expand All @@ -16,6 +17,7 @@ public class TokenService {
private static final String BEARER_TOKEN_TEMPLATE = "Bearer %s";

@Autowired
@Qualifier("fintOauthRestTemplate")
private OAuth2RestTemplate restTemplate;

@Autowired
Expand Down

0 comments on commit 1e9a6aa

Please sign in to comment.