I am using Eureka Discovery Server. I can call one microservice from another microservices by Resttemplate
by using service name, that is visible to Eureka Server. I have heard that in near future Resttemplate
will be deprecated.
I can also call one microservice from another microservices, by using WebClient
, but in this case, i required to use the entire host name. I am not able to call them service name.
Yes i can set the base url from properties file, so that without restarting the jar, we will able to change the base url. If we do so, then we may not need any discovery server.
My question is there any way to call microservices by name, by WebClient?
If no way to call, then do we any more need the discovery server
?
Webclient also work with service names like rest template.
See this example of using Webclient and resolving service name from Eureka server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.