Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Feign Client and name from properties

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?

like image 671
user3528733 Avatar asked Jan 25 '26 11:01

user3528733


1 Answers

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

like image 110
Magesh Avatar answered Jan 27 '26 00:01

Magesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!