Confirm Sales Order + Eureka POST

I am trying to use Feign and Eureka to forward a send request from server A to server B. Both servers are perfectly protected from Eureka.

It works:

@Feignclient
public interface MyFeignClient {
    @RequestMapping(value = "test", = RequestMethod.POST, consumes = "application/json")
    ResponseEntity<String> theActualMethod(
            HttpServletRequest request,
            @RequestHeader("firstHeader") String header1,
            @RequestHeader("secondHeader") byte[] header2);
}

However, when I change the second argument to @RequestBody to read the contents of the POST request, I get an exception:

java.lang.IllegalStateException: Method has too many Body parameters: public abstract org.springframework.http.ResponseEntity MyFeignClient.theActualMethod(javax.servlet.http.HttpServletRequest,java.lang.String,byte[])
+5
source share
2 answers

, Feign "" . , , . @RequestBody , , HttpServletRequest.

-, .

+5

, @Param ( feign.Param) @RequestParam ( org.springframework.web.bind.annotation.RequestParam). @Param @RequestParam .

, , Feign .

0

Source: https://habr.com/ru/post/1627741/


All Articles