title: Custom controller with Spring Data REST hide default endpoints
body: <p>I'm using Spring Boot, Spring Data REST, Spring HATEOAS, Hibernate, JPA.</p>
  
  <p>I'm using extensively Spring Data REST in my application and I expose all Repositories of my entities.
  Unfortunately there are some particular cases that are not so easy to manage.
  One of that is this:</p>
  
  <p>I've a custom controller:</p>
  
  <pre><code>@Api(tags = "CreditTransfer Entity")
  @RepositoryRestController
  @RequestMapping(path = "/api/v1")
  @PreAuthorize("isAuthenticated()")
  public class CreditTransferController {
  
  @RequestMapping(method = RequestMethod.GET, path = "/creditTransfers/{id}")
      public ResponseEntity&lt;?&gt; findAll(@PathVariable("id") long id, HttpServletRequest request, Locale locale,
              PersistentEntityResourceAssembler resourceAssembler) {
          //my code
  
      }
  
      @RequestMapping(method = RequestMethod.DELETE, path = "/creditTransfers/{id}")
      public ResponseEntity&lt;?&gt; deleteMovement(@PathVariable("id") long id, HttpServletRequest request, Locale locale,
              PersistentEntityResourceAssembler resourceAssembler) {
          //my code
      }
  </code></pre>
  
  <p>The problem here is that overriding these endpoints, I am hiding the /search endpoint that Spring Data REST create. And that is very important to me.</p>
  
  <p>I did't find any smart way to make this to work without interfer with defaults endpoints provided from Spring Data REST.</p>
  
  <p>Is there a way to solve my problem?</p>
  
  <p>======================================================================</p>
  
  <p>A small enhancement is using a mapping like this:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.DELETE, path = "/creditTransfers/{id:[0-9]+}")
  </code></pre>
  
  <p>In this way my controller doesn't catch the url <code>localhost:8080/api/v1/creditTransfers/search</code> but still, if I override just the DELETE method, when I try to <code>GET localhost:8080/api/v1/creditTransfers</code> I've the error <code>Request method 'GET' not supported</code>. Seems my controller override ALL methods for a specific path and not just the one I set.</p>