Hi,

I use Feign Client to communicate between microservices and some of my services contains parameters in the context path. When I put them in url as follows, Feign client doesn't render it.

@FeignClient(name = "server-xxxxxx", url = "http://my_host/api/sample_service/{resource_name}")
interface CandlestickClient {
    @GetMapping("sample_endpoint")
    fun getCandlesticks(
        @PathVariable("resource_name") resourceName: String
    ): List<String>
}

I don't want to copy and paste path variable to each method. Can you check the problem here?

Thanks

Comment From: Junhyunny

url in @FeignClient doesn't take '{' character. It makes Exception. How about using {resource_name} in @GetMapping Annotation like this?

@FeignClient(name = "server-xxxxxx", url = "http://localhost:8080")
interface CandlestickClient {

    @GetMapping("/{resourceName}/endpoint")
    List<String> getCandlesticks(@PathVariable(name = "resourceName") String resourceName);
}

Here is my example. https://github.com/Junhyunny/openfeign-test

Test command "curl localhost:8080/test".

Comment From: spencergibb

the url should just be host and port all the path should be in the @GetMapping and there the path variables can be used.

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.