Describe the bug I was trying for openfeign application and found that openfeign is not able to find the service by name in eureka server but works fine when i use the url attribute and hardcode the hostname and port.

Created two spring boot microservices with below details Demo1 > application.properties Spring Cloud Netflix Feign Client could not search the service by name in eureka Demo2>application.properties Spring Cloud Netflix Feign Client could not search the service by name in eureka

Spring Cloud Netflix Feign Client could not search the service by name in eureka Spring Cloud Netflix Feign Client could not search the service by name in eureka Spring Cloud Netflix Feign Client could not search the service by name in eureka Spring Cloud Netflix Feign Client could not search the service by name in eureka Spring Cloud Netflix Feign Client could not search the service by name in eureka

Output: Spring Cloud Netflix Feign Client could not search the service by name in eureka Spring Cloud Netflix Feign Client could not search the service by name in eureka The second output after few seconds.

Can you please help here? NOTE: The same thing worked only once from office but when i tried again another day its failing not sure why

Comment From: spencergibb

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: pkumar53

I resolved the issue by deleting all the unnecessary host names present in the host file. The issue was happening due to multiple host names present in the laptop's host file and the microservices were not registering with localhost or laptop name rather were registering with some other host name present in the host file. As soon as I deleted the host name from the host file, the services started registering with the correct host name and then communication between microservice started working properly.

Comment From: pkumar53

Wondering what if I need to have some other host name in the host file. In that case, how do I register my microservice with eureka for a correct hostname out of the many hostnames present in the host file.

Comment From: spencergibb

The host shouldn't really matter. If spring cloud can't make an accurate guess, you should set it explicitly

Comment From: pkumar53

is there any property available as I remember setting eureka.instance.hostname for the microservice but still it did not work at that time. If there is any other property, please let know.

Comment From: spencergibb

That is the property

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.