I have sth like this,
@FeignClient(name = "${airport.service.name}")
And I have compilation error like,
java.lang.IllegalStateException: Service id not legal hostname (${airport.service.name})
The question is how can I pass hostname form applciation.yaml to FeignClient?
Though it is late, I am updating my answer since I faced this exception (java.lang.IllegalStateException: Service id not legal hostname) while using feign client in spring cloud The root cause is feign client won't accept service name with under score, Please go through the below link. To resolve this issue I renamed the service name to be used by feign client with hypen(school-service) instead of understore(school_service)
Github link - spring-cloud-netflix - Issue Github link - spring-cloud-netflix - commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With