More information on Eureka documentation.
Get EurekaClient
instance and call the the needed information using the micro-service
name.
@Qualifier("eurekaClient")
@Autowired
private EurekaClient eurekaClient;
public String courseUrl() {
// the micro-service name is 'course' and the service is secured
InstanceInfo info = eurekaClient.getNextServerFromEureka("course", true);
return info.getHomePageUrl();
}