-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Sam Brannen opened SPR-13087 and commented
Status Quo
#17659 introduced support for synthesizing an annotation from a Map (or AnnotationAttributes). This initial support also validates the supplied map and requires that it "must contain key-value pairs for every attribute defined by the supplied annotationType."
The validation that MapAnnotationAttributeExtractor currently performs was implemented in order to support Spring's internal use case of synthesizing an annotation from merged AnnotationAttributes (as created by AnnotatedElementUtils), and for that use case it is in fact an error if any attributes defined by the annotation are not present (including aliased attributes).
However, there are use cases that would benefit from being able to supply a reduced set of attributes and still have the annotation synthesized properly. See the discussion in this Spring Integration pull request for an example.
Deliverables
- Refine the validation mechanism in
MapAnnotationAttributeExtractorso that a reduced set of attributes may be supplied.- If an attribute is missing it should be set either to value of its alias (if an alias value exists) or to the value of the attribute's default value (if defined), and otherwise an exception should be thrown.
Affects: 4.2 RC2
Issue Links:
- INT-3723 Fix IntegrationRequestMappingHandlerMapping according to the latest Spring Framework changes