title: Rest Controllers vs spring-data-rest RepositoryRestResource
body: <p>I know this might feel like a duplicate of this.<br>
  <a href="https://stackoverflow.com/questions/22824840/when-to-use-restcontroller-vs-repositoryrestresource">When to use @RestController vs @RepositoryRestResource</a><br>
  But I have a few things which were not addressed in that question.  </p>
  
  <ol>
  <li><p>With <code>@RepositoryRestResource</code>, every method is by default exposed. Which I feel is a bit annoying. Correct me if I am wrong here. For example in the below case  </p>
  
  <pre><code>@RepositoryRestResource  
  public interface ProductRepository extends MongoRepository&lt;Product, String&gt; {} 
  </code></pre></li>
  </ol>
  
  <p>If I want only findAll() and findOne() to be exposed and not any other methods, especially delete.  To achieve this I need to do something like this </p>
  
  <pre><code>    @RepositoryRestResource
      public interface ProductRepository extends MongoRepository&lt;Product, String&gt; {
        @RestResource(exported = false)
        @Override
        default void delete(String s) {
        }
        @RestResource(exported = false)
        @Override
        default void delete(Product product) {
        }
        @RestResource(exported = false)
        @Override
        default void delete(Iterable&lt;? extends Product&gt; iterable) {
        }
        @RestResource(exported = false)
        @Override
        default void deleteAll() {
        }
      }
  </code></pre>
  
  <p>Which I feel is really lot of unwanted code. This is much better to do with Rest Controller approach  </p>
  
  <ol start="2">
  <li><p>I believe it is better to return any value from REST endpoints using ResponseEntity. But with spring-data-rest approach, I am not sure how to do it.    </p></li>
  <li><p>I could not find any way to unit test(Not IT) REST endpoints exposed by the RepositoryRestResource. But with REST controller approach, I can test my REST endpoints using <code>MockServletContext</code>, <code>MockMvc</code>, <code>MockMvcBuilders</code>  </p></li>
  </ol>
  
  <p>Given all these, is it still advantageous to use sping-data-rest(except for HATEOS)?<br>
  please clarify</p>