question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebRequest parameter should by ignored by Feign SpringMvcContract

See original GitHub issue

Currently following interface method:

ResponseEntity<ModelSO> getSubscriptionInformation(
       @RequestBody @ApiParam(name = "request", value = "The body of the request", required = true) 
       ModelSO model, // body 1
       WebRequest webRequest); // body2 ?

can’t be used as Feign Client:

java.lang.IllegalStateException: Method has too many Body parameters: public abstract org.springframework.http.ResponseEntity com.daimler.daivb.vts.snap.SubscriptionInformationSI.getSubscriptionInformation(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.daimler.daivb.vts.snap.SubscriptionRequestSO,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.springframework.web.context.request.WebRequest)
	at feign.Util.checkState(Util.java:128)
	at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:114)
	at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:131)
	at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
	at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
	at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
	at feign.Feign$Builder.target(Feign.java:209)
	at feign.Feign$Builder.target(Feign.java:205)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jvstepanova84commented, Mar 27, 2019

The same problem with

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/status_bso",
            produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
    ResponseEntity<Response> statusBso(@RequestBody Request request, Errors errors);

where Error is org.springframework.validation.Errors

I can’t use Feign with spring validation in controller, because I have error Method has too many Body parameters

0reactions
OlgaMaciaszekcommented, Mar 27, 2019

@jvstepanova84 Have you tried using the workaround provided by @tjuchniewicz above?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Cloud OpenFeign Failed to Create Dynamic Query ...
Spring cloud openFeign can't create dynamic query parameters. It throws below exception because SpringMvcContract tries to find the ...
Read more >
Introduction to Spring Cloud OpenFeign - Baeldung
In this tutorial, we're going to describe Spring Cloud OpenFeign — a declarative REST client for Spring Boot apps.
Read more >
Spring Cloud OpenFeign
Feign is a declarative web service client. It makes writing web service clients easier. To use Feign create an interface and annotate it....
Read more >
Passing headers with Spring Cloud Feign - Arnold Galovics
Fortunately, you can use Spring MVC annotations to pass the header to the translator service as a simple parameter. Let's see in practice, ......
Read more >
Feign - Bloglovin'
Should Feign interface has @PathVariable and @RequestParam annotations with stated ... processAnnotationsOnParameter(SpringMvcContract.java:280) at feign.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found