title: How to pass Pageable to Feign Client in POST Request with additional @RequestBody
body: <p>I tried to create a feign client for my REST service controller in Spring.</p>
  <pre><code>@PostMapping(&quot;/search&quot;)
  public Page&lt;MeasureDto&gt; searchMeasures(@RequestBody MeasureDto example, Pageable pageable) {
      ...
  }
  </code></pre>
  <p>The client looks like this:</p>
  <pre><code>@PostMapping(&quot;/search&quot;)
  public Page&lt;MeasureDto&gt; searchMeasures(@RequestHeader(&quot;apiKey&quot;) String apiKey, @RequestBody MeasureDto example, Pageable pageable);
  </code></pre>
  <p>Following exception is thrown when running a test:</p>
  <blockquote>
  <p>Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract org.springframework.data.domain.Page com.foo.bar.jobservice.client.MeasureServiceClient.searchMeasures(java.lang.String,com.example.foo.jobservice.client.dto.MeasureDto,org.springframework.data.domain.Pageable)</p>
  </blockquote>
  <p>What I already know/tried:</p>
  <p>There is a closed issue on github: <a href="https://github.com/spring-cloud/spring-cloud-netflix/issues/556" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-netflix/issues/556</a></p>
  <p>The issue with the commit that should have resolved the problem:</p>
  <p><a href="https://github.com/spring-cloud/spring-cloud-openfeign/issues/26" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-openfeign/issues/26</a></p>
  <p>The commit:</p>
  <p><a href="https://github.com/spring-cloud/spring-cloud-openfeign/commit/6e0e63644ba34193f03c2cd74391cac73b9bfdb4" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-openfeign/commit/6e0e63644ba34193f03c2cd74391cac73b9bfdb4</a></p>
  <p>What i configured:</p>
  <pre><code>import feign.codec.Encoder;
  import org.springframework.beans.factory.ObjectFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
  import org.springframework.cloud.openfeign.EnableFeignClients;
  import org.springframework.cloud.openfeign.support.PageJacksonModule;
  import org.springframework.cloud.openfeign.support.PageableSpringEncoder;
  import org.springframework.cloud.openfeign.support.SpringEncoder;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  @EnableFeignClients
  @Configuration
  public class FeignConfig {
  
      @Bean
      public PageJacksonModule pageJacksonModule() {
          return new PageJacksonModule();
      }
  
      @Autowired
      private ObjectFactory&lt;HttpMessageConverters&gt; messageConverters;
  
      @Bean
      public Encoder feignEncoder() {
          return new PageableSpringEncoder(new SpringEncoder(messageConverters));
      }
  }
  </code></pre>
  <p>Still not working.</p>
  <p>What I am using:</p>
  <pre><code>&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
  &lt;version&gt;2.3.1.RELEASE&lt;/version&gt;
  
  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
  &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;/artifactId&gt;
  &lt;version&gt;2.2.3.RELEASE&lt;/version&gt;
  </code></pre>
  <p>What am I doing wrong?</p>
  <hr />
  <p><strong>Update:</strong></p>
  <p>I created a reproducable example:</p>
  <p><a href="https://github.com/manuelwaltschek/mre.git" rel="nofollow noreferrer">https://github.com/manuelwaltschek/mre.git</a></p>
  <p>Start up the client service or call
  spring/spring-cloud-openfeign/375-pageable-not-working/parent/client/src/test/java/com/example/client/HelloServiceClientTest.java</p>
  <p>Open issues on github:
  <a href="https://github.com/spring-cloud/spring-cloud-openfeign/issues/375" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-openfeign/issues/375</a>
  <a href="https://github.com/spring-cloud/spring-cloud-openfeign/issues/385" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-openfeign/issues/385</a></p>
  <p>Edit: Basically I want to know how to pass the pageable to the feign client. Maybe encode it in url params?</p>
  <p>Related question: <a href="https://stackoverflow.com/questions/63152147/how-to-pass-spring-pageable-to-feignclient">how to pass Spring Pageable to FeignClient</a></p>