Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-11108

Support composed annotations declared on interfaces

    Details

    • Last commented by a User:
      false

      Description

      Status Quo

      The findAnnotation() methods in AnnotationUtils currently support searching for meta-annotations declared on composed annotations that are declared on interfaces; however, various parts of the framework – for example, code that relies on AnnotationAttributes – only support composed annotations on classes or methods (not on interfaces or interface methods).

      For example, given the following:

      @Target({ElementType.TYPE, ElementType.METHOD})
      @Retention(RetentionPolicy.RUNTIME)
      @Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
      public @interface TxWithAttribute {
      
      	boolean readOnly();
      }
      
      @TxWithAttribute(readOnly = true)
      public static interface TestInterface9 {
      
      	public int getAge();
      }
      
      public static class TestBean9 implements TestInterface9 {
      
      	@Override
      	public int getAge() {
      		return 10;
      	}
      }
      
      public static interface TestInterface10 {
      
      	@TxWithAttribute(readOnly=true)
      	public int getAge();
      }
      
      public static class TestBean10 implements TestInterface10 {
      
      	@Override
      	public int getAge() {
      		return 10;
      	}
      }
      

      Spring's support for resolving transaction attributes (e.g., the AbstractFallbackTransactionAttributeSource.computeTransactionAttribute() to SpringTransactionAnnotationParser.parseTransactionAnnotation() call stack) fails to find @Transactional which is declared via @TxWithAttribute on interfaces.

      Proposal

      Introduce support for composable stereotype annotations declared on interfaces.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sbrannen Sam Brannen
                Reporter:
                sbrannen Sam Brannen
                Last updater:
                Juergen Hoeller
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  3 years, 22 weeks, 5 days ago