title: Conflict in Using @RepositoryRestController and @RepositoryRestResource For a Single Resource in Spring Boot
body: <p>I have a Payment entity in my spring boot application. Considering all possible CRUD operations, I'm using spring data rest for <code>read</code> and want to implement a custom <code>create</code> operation. Also <code>delete</code> and <code>update</code> are not allowed for this entity.</p>
  
  <p>So this is my desired URLs and resoponsible component for each one:</p>
  
  <p><code>GET /payments</code> : PaymentRepository</p>
  
  <p><code>GET /payments/{id}</code> : PaymentRepository</p>
  
  <p><code>POST /payments</code> : PaymentController</p>
  
  <p>This is my repository:</p>
  
  <pre><code>@RepositoryRestResource
  public interface PaymentRepository extends PagingAndSortingRepository&lt;Payment, Long&gt; {
  
      // disable create and update
      @Override
      @RestResource(exported = false)
      Payment save(Payment entity);
  
      // disable delete
      @Override
      @RestResource(exported = false)
      void delete(Payment entity);
  }
  </code></pre>
  
  <p>And this is my controller:</p>
  
  <pre><code>@RepositoryRestController
  @RequestMapping("/payments")
  public class PaymentController {
  
      @PostMapping("")
      @ResponseBody
      public Payment create() {
          // some code...
      }
  
  }
  </code></pre>
  
  <p>If I map <code>create</code> operation to a url like <code>POST /payments/create</code>, everything works fine, but If I use the above code and map <code>create</code> to <code>POST /payments</code>, the <code>GET /payments</code> url does not work any more and I get <code>405 Method Not Allowed</code> error. (<code>GET /payments/{id}</code> is still working)</p>
  
  <p>It seems in this case presence of <code>@PostMapping("")</code> annotation, cause the <code>PaymentController</code> to responsd the <code>GET /payments</code> request and it fails.</p>
  
  <p>I hope my explanations were clear. How can I solve this problem?</p>