title: Why a defined pointcut with @target doesn't work?
body: <p>I'm trying to use Spring aspects to do save aditional data while storing documents with <code>MongoRepository</code>. The target is this interface:</p>
  
  <pre><code>@InSearch
  public interface ItemRepository extends MongoRepository&lt;Item, Long&gt;, 
      ItemRepositoryCustom 
  {
      List&lt;Item&gt; findAllByUsername( String username );
      List&lt;Item&gt; findAllBySessionId( Long sessionId );
  }
  </code></pre>
  
  <p>When I use this pointcut:</p>
  
  <pre><code>@Pointcut( "execution(* save(..)) &amp;&amp; " + 
      "target(org.springframework.data.mongodb.repository.MongoRepository)" )
  private void saveEntity()
  {}
  </code></pre>
  
  <p>This method runs ok before <code>open</code> method is called:</p>
  
  <pre><code>@Before( "saveEntity() &amp;&amp; args(entity)" )
  public void beforeSavingEntity( JoinPoint jp, AuditedBean entity )
  { ... }
  </code></pre>
  
  <p>But I want it to run only with interfaces annotated with <code>@InSearch</code> so I tried to define the pointcut that way:</p>
  
  <pre><code>@Pointcut( "execution(* save(..)) &amp;&amp; " +
      "target(org.springframework.data.mongodb.repository.MongoRepository) &amp;&amp; " +
      "@target(xx.annotations.InSearch)" )
  private void saveEntity()
  {}
  </code></pre>
  
  <p>The annotation definition:</p>
  
  <pre><code>@Target( { ElementType.TYPE} )
  @Retention(RetentionPolicy.RUNTIME)
  public @interface InSearch
  {}
  </code></pre>
  
  <p>With this pointcut the method <code>beforeSavingEntity</code> is not called. I've not any error on log. I'm not sure if I had understood the documentation about <code>@target</code> and his differences with <code>@within</code>. I've tried also with <code>@within</code> and didn't work either.</p>
  
  <p>How must I define this pointcut to select <code>save</code> methods execution in a class that implements an interface that extends <code>MongoRepository</code> and is annotated with <code>@InSearch</code>?</p>
  
  <p>Thank you!</p>