Closed
Description
Gary Russell opened SPR-11709 and commented
In AnnotationReadingVisitorUtils.getMergedAnnotationAttributes()
, the attributes closer to the annotated element override those in the hierarchy.
It would be useful if this only occurred if the closer attribute was not-empty.
For example:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@MessagingGateway(defaultRequestChannel = "gatewayChannel",
defaultHeaders = @GatewayHeader(name = "foo", value = "FOO"))
public static @interface TestMessagingGateway {
String defaultRequestChannel() default "";
}
This allows the user to override the "default" setting in the meta-annotation, but the current logic replaces the default with "" if the user does not specify a value when using the annotation.
The same applies to attributes with array values; consider preventing the override of a higher-up array with an empty array closer to the declaration.
Affects: 4.0.3
Issue Links:
- Support meta-annotation attribute overrides in ASM-based annotation processing [SPR-11574] #16198 Support meta-annotation attribute overrides in ASM-based annotation processing
- AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() overrides values it should not [SPR-11649] #16272 AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() overrides values it should not
- AnnotatedElementUtils fails to find annotations on abstract, bridge, or interface methods [SPR-12738] #17335 AnnotatedElementUtils fails to find annotations on abstract, bridge, or interface methods
- INT-3376 Merge Messaging Meta-Annotation Attributes
0 votes, 5 watchers