Skip to content

Instantly share code, notes, and snippets.

@tinmegali
Created June 28, 2019 21:18
Show Gist options
  • Save tinmegali/d08a1f18c6cec3692b91c23787086f4c to your computer and use it in GitHub Desktop.
Save tinmegali/d08a1f18c6cec3692b91c23787086f4c to your computer and use it in GitHub Desktop.

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();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment