I wanted to know how to pass Basic Auth username and password to the resttemplate so that other application allow me to access the end points
Suppose I have Basic auth in my secondary application
username:randomSecureKeyUsername!
password:randomSecureKeyPassword!
And here is my restTemplate
@GetMapping
public Train[] getTrains() {
return restTemplate.getForObject("http://train-detail-service/api/rail", Train[].class);
}
I am trying to retrieve the list of trains from the other microservice application.
Note: These all application are running on eureka server that's why I am using application name
tion name