title: How to customize MongoRepository without overriding the annotated @Query methods in interface?
body: <p>I want to customize MongoRepository by adding one method, and still using the implemented methods provided by MongoRepository. Below is the code: </p>
  
  <pre><code>public interface TopoRepositoryInterface extends MongoRepository&lt;Topo, String&gt;
  {
      @Query("{'name':?0}")
      public Topo findByName(String name);
  
      public long getPublishedTopoCount();
  }
  </code></pre>
  
  <p>the implementation declaration is:</p>
  
  <pre><code>public class TopoRepositoryImpl extends SimpleMongoRepository&lt;Topo, String&gt; implements TopoRepositoryInterface
  </code></pre>
  
  <p>If without the customization,  method findByName declared in TopoRepositoryInterface can be automatically implemented by adding @Query("{'name':?0}") annotation. But now, since there is interface inheritage, I must add code </p>
  
  <pre><code>@Override
  public Topo findByName(String name)
  {
      Topo topo = getMongoOperations().findOne(Query.query(Criteria.where("name").is(name)), Topo.class);
      return topo;
  }
  </code></pre>
  
  <p>Is there any way to write my own code for getPublishedTopoCount() only, and leave findByName() be implemented by @Query annotation? Thank you very much. </p>