Created
March 14, 2018 20:04
-
-
Save radutoev/c52e773fd7491448f8d7ae14af106fe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
TokenString tokenString; | |
public String callB() { | |
RestTemplate restTemplate = new RestTemplate(); | |
HttpHeaders headers = new HttpHeaders(); | |
headers.set("Authorization", "bearer " + tokenString.getValue()); | |
HttpEntity entity = new HttpEntity(headers); | |
ResponseEntity re = restTemplate.exchange(<SERVICE_B_ADDRESS>, HttpMethod.GET, entity, String.class); | |
return re.getStatusCode().equals(HttpStatus.OK) ? "ok" : "not ok"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment