Sam Brannen opened SPR-11515 and commented

Status Quo

Over the past several releases, the Spring Framework has continually enhanced its support for meta-annotations and custom composed annotations, potentially with meta-annotation attribute overrides. However, the programming model is not clearly documented in the reference manual. Furthermore, new features for annotation attribute aliases and meta-annotation support have been introduced in 4.2, and these will need to be clearly documented as well.


Deliverables

In the Spring Framework Wiki, introduce a new page covering all features of Spring's support for meta-annotations, including but not limited to the following.

  1. [ ] Document the general search algorithm(s) for annotations and meta-annotations on classes, interfaces, methods, and annotations.
  2. What happens if an annotation is present on an element both locally and as a meta-annotation?
  3. How does the presence of @Inherited on an annotation (including custom composed annotations) affect the search algorithm?
    • See #16100.
  4. [ ] Document support for annotation attribute aliases configured via @AliasFor.
  5. How does one declare that an attribute is an alias for another attribute within the same annotation?
  6. What happens if an attribute and its alias are declared in an annotation instance (with the same value or with different values)?
    • The presumed behavior is that an AnnotationConfigurationException will be thrown.
    • See #16137.
  7. See #16020.
  8. [ ] Document support for composed annotations.
  9. [ ] Document support for meta-annotation attribute overrides in composed annotations.
  10. Document the algorithm used when looking up attributes, specifically explaining:
    • implicit mapping based on naming convention (i.e., composed annotation declares an attribute with the exact same name and type as declared in the overridden meta-annotation)
    • explicit mapping using the annotation-based mechanism introduced in #16138
  11. What happens if an attribute and one of its aliases are declared somewhere within the annotation hierarchy? Which one takes precedence?
  12. In general, how are conflicts involving annotation attributes resolved?
  13. [ ] Document the special handling of the value attribute for @Component and @Qualifier, or cross reference existing documentation as appropriate.

Annotations Using @AliasFor as of Spring Framework 4.2

  • org.springframework.cache.annotation.Cacheable
  • org.springframework.cache.annotation.CacheEvict
  • org.springframework.cache.annotation.CachePut
  • org.springframework.context.annotation.ComponentScan.Filter
  • org.springframework.context.annotation.ComponentScan
  • org.springframework.context.annotation.ImportResource
  • org.springframework.context.annotation.Scope
  • org.springframework.context.event.EventListener
  • org.springframework.jmx.export.annotation.ManagedResource
  • org.springframework.messaging.handler.annotation.Header
  • org.springframework.messaging.handler.annotation.Payload
  • org.springframework.messaging.simp.annotation.SendToUser
  • org.springframework.test.context.ActiveProfiles
  • org.springframework.test.context.ContextConfiguration
  • org.springframework.test.context.jdbc.Sql
  • org.springframework.test.context.TestExecutionListeners
  • org.springframework.test.context.TestPropertySource
  • org.springframework.transaction.annotation.Transactional
  • org.springframework.transaction.event.TransactionalEventListener
  • org.springframework.web.bind.annotation.ControllerAdvice
  • org.springframework.web.bind.annotation.CookieValue
  • org.springframework.web.bind.annotation.CrossOrigin
  • org.springframework.web.bind.annotation.MatrixVariable
  • org.springframework.web.bind.annotation.RequestHeader
  • org.springframework.web.bind.annotation.RequestMapping
  • org.springframework.web.bind.annotation.RequestParam
  • org.springframework.web.bind.annotation.RequestPart
  • org.springframework.web.bind.annotation.ResponseStatus
  • org.springframework.web.bind.annotation.SessionAttributes
  • org.springframework.web.portlet.bind.annotation.ActionMapping
  • org.springframework.web.portlet.bind.annotation.RenderMapping

Affects: 4.0 GA

Issue Links: - #16137 Introduce unified support for declaring and looking up annotation attribute aliases ("depends on") - #16138 Introduce support for explicit annotation attribute overrides ("depends on") - #16020 Introduce aliases for 'value' annotation attributes ("depends on") - #18022 Introduce predefined composed annotations in core Spring - #16136 Introduce a comprehensive programming model for meta-annotation support - #18020 Use AnnotatedElementUtils instead of AnnotationUtils wherever feasible - #21117 Update Spring Annotation Programming Model to reflect status quo

0 votes, 6 watchers

Comment From: spring-projects-issues

Sam Brannen commented

Location of Wiki page: Spring Annotation Programming Model