Feign Client with Spring Boot: RequestParam.value() was empty on parameter 0

Viewed 27309

I created a simple Feign Client with Spring Boot like this:

@FeignClient("spring-cloud-eureka-client")
public interface GreetingClient {
    @RequestMapping("/greeting")
    String greeting(@RequestParam String name);
}

But when I try just to start an application I get an error:

java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

First I didn't understand what is the reason and googled a lot but didn't find an answer. Almost excidentely I figured out that it works if to write request param name explicitly:

@RequestParam("name") String name

So my question: is it a bug or could it be configured to not write request params names explicitly?

3 Answers

Just use String greeting(@RequestParam("name") String name);

    @FeignClient("spring-cloud-eureka-client")
    public interface GreetingClient {
       @RequestMapping("/greeting")
       String greeting(@RequestParam("name") String name);
    }
Related