According to the documentation of FeignClient
for value()
:
/**
* The name of the service with optional protocol prefix. Synonym for {@link #name()
* name}. A name must be specified for all clients, whether or not a url is provided.
* Can be specified as property key, eg: ${propertyKey}.
* @return the name of the service with optional protocol prefix
*/
@AliasFor("name")
String value() default "";
and name()
:
/**
* @return The service id with optional protocol prefix. Synonym for {@link #value()
* value}.
*/
@AliasFor("value")
String name() default "";
So along with url
you should provide either a name
or value
for your feign client
Also, if you get an error java.lang.IllegalStateException: Service id not legal hostname
while using feign client, the cause may be is that feign client does not accept service name with under score. Just check this. The rules for naming are not documented, this point is just from my experience.
Also, you can read the reference where pointed:
Previously, using the url attribute, did not require the name
attribute. Using name is now required.