markdown Spring / Eureka / Jhipster-Registry:获取微服务URL

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Spring / Eureka / Jhipster-Registry:获取微服务URL相关的知识,希望对你有一定的参考价值。

More information on [Eureka documentation](https://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html).

Get `EurekaClient` instance and call the the needed information using the `micro-service` name.

``` java
    @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();
    }
```

以上是关于markdown Spring / Eureka / Jhipster-Registry:获取微服务URL的主要内容,如果未能解决你的问题,请参考以下文章

Spring Cloud Eureka 3 (Eureka client注册服务提供者)

spring cloud 之eureka配置

Spring Cloud Eureka

3Spring Cloud - Eureka(高可用Eureka Server集群)

spring cloud 注册与发现Eureka

Eureka 系列(03)Spring Cloud 自动装配原理