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的主要内容,如果未能解决你的问题,请参考以下文章