spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

IllegalStateException when path variable is specified in @FeignClient path

Open tedliang opened this issue 3 years ago • 0 comments
trafficstars

Describe the bug Got the following error while starting the app:

Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: Body parameters cannot be used with form parameters.
Warnings:
- 
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)

org.springframework.cloud:spring-cloud-starter-openfeign:3.1.1

@FeignClient(name = "foo-service", path = "/user/{userId}")
public interface FooService {
    @RequestMapping(value = "/foo", method = RequestMethod.POST)
    void doFoo(@PathVariable Long userId, @RequestBody User user);
}

Works fine if there is no @RequestBody in the method.

tedliang avatar Apr 27 '22 00:04 tedliang