@RequestMapping "path" is not considered in Feign contract even though it's an alias for "value"
See original GitHub issueThe following client definition ends up ignoring the “path” argumet in RequestMapping, therefore causing a “java.lang.IllegalStateException: Body parameters cannot be used with form parameters.”.
To correct this all you have to do is to change “path” to “value”, but since those are aliases the implementation should example both.
@FeignClient(url = "http://localhost:8181")
interface PlatformClient {
@RequestMapping(path = "/rest/some/{id}",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
void execute(@PathVariable(value = "id") String id, SomeObject data);
}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Developers - @RequestMapping "path" is not considered in Feign ...
RequestMapping "path" is not considered in Feign contract even though it's an alias for "value"
Read more >Can't get Feign Client to work for a basic example
I was able to use Feign successfully although we did not really use 'ribbon'. We used as Rest Client since it is much...
Read more >7. Declarative REST Client: Feign - Spring Cloud
To specify your own alias value you can use the qualifier value of the @FeignClient annotation. The Ribbon client above will want to...
Read more >Using the Spring @RequestMapping Annotation
The class-level annotation maps a specific request path or pattern ... a default value when the request param is not provided or is...
Read more >Spring Annotations: @RequestMapping and its Variants
Here, after the mapping, we encase the path variable with curly brackets ( {} ) and assign that value to our productId ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Request body parameters should be placed in front. try
void execute( SomeObject data,@PathVariable(value = "id") String id);
It works! @zdRan