title: How to disable paging for JpaRepository in spring-data-rest
body: <p>I'm using <a href="/questions/tagged/spring-data-rest" class="post-tag" title="show questions tagged &#39;spring-data-rest&#39;" rel="tag">spring-data-rest</a> with <code>JpaRepository</code> to create the Rest-Endpoints. By default, paging is enabled for all <code>JpaRepository</code>, what is a good thing. But I have a legacy application that we port to our new stack that does not support paging. I would like to disable paging depending on an URL-Parameter to still be able to use paging in new application code. </p>
  
  <p>I tried various approaches to expose the resources with and without paging: </p>
  
  <ul>
  <li>Use <code>CrudRepository</code>: Results in only having an unpaged endpoint and the method <code>flush</code> is missing.</li>
  <li>Override the <code>List&lt;T&gt; findAll()</code> method in my repository interface and annotated it with <code>RestResource</code>. I would have expected that the method will be exposed as search method, but it is not. </li>
  <li>Annotate <code>Page&lt;T&gt; findAll(Pageable pageable)</code> with <code>@RestResource(exported=false)</code> and annotate <code>List&lt;T&gt; findAll()</code> as in the bullet before. I have hopped that this replaces the default method. But this is not valid solution anyway, because only a non paged endpoint is exposed.</li>
  <li>Pass <code>size=-1</code> to get an unlimited result -> Default paging size is used</li>
  </ul>
  
  <p>I've seen that the spring-controller <code>RepositoryEntityController</code> uses a <code>RepositoryInvoker</code> to call the methods on the repository.  The <code>Pageable</code> is resolved using the <code>PageableHandlerMethodArgumentResolver</code> which always returns a pageable (specified in query, annotated or default pageable). 
  The only solution that I see for the moment is to implement a custom <code>PageableHandlerMethodArgumentResolver</code> that returns null, if a custom url parameter is passed.</p>
  
  <p>Do you know any other solutions or is anything similar planned for the future?</p>