title: Spring AOP annotation based pointcuts for ElementType.TYPE?
body: <p>I have a service implementation carrying a class-wide @Transactional annotation. I also have an aspect that uses the @Around advice to retry failed transactions. I'm now trying (for type-safety reasons) to make the pointcut definition annotation based:</p>
  
  <pre><code>@Around("@annotation(TransactionRetryable)")
  </code></pre>
  
  <p>TransactionRetryable.java:</p>
  
  <pre><code>    import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;
      import java.lang.annotation.ElementType;
  
      @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.METHOD, ElementType.TYPE})
      public @interface TransactionRetryable {
      }
  </code></pre>
  
  <p>Service layer:</p>
  
  <pre><code>@Transactional
  public class ... {
          @Override
          @TransactionRetryable
          public String forceError() {
              throw new RuntimeException(someNastyMessage);
          }
  </code></pre>
  
  <p>In that form, it only applies to method, not whole classes. However, the @Transactional annotation propagates from class level to each method. Is there a way to avoid putting the @TransactionRetryable annotation above each method and simply once above the class like the @Transactional annotation? Desired form:</p>
  
  <pre><code>@Transactional
  @TransactionRetryable
  public class ... {
          @Override
          public String forceError() {
              throw new RuntimeException(someNastyMessage);
          }
  </code></pre>