Repository navigation
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issuetype: enhancementA general enhancement
Description
Grzegorz Poznachowski opened SPR-13803 and commented
I want to wrap @JmsListener annotation with a custom one (to avoid providing containerFactory attribute):
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JmsListener(containerFactory = "customJmsContainerFactory", destination = "")
public @interface CustomJmsListener {
@AliasFor(annotation = JmsListener.class, attribute = "destination")
String destination();
@AliasFor(annotation = JmsListener.class, attribute = "selector")
String selector() default "";
@AliasFor(annotation = JmsListener.class, attribute = "concurrency")
String concurrency() default "";
}As destination is a required attribute I need to provide its value: destination = "". I would expect that it would be overridden by specifying destination attribute on @CustomJmsListener, however the @JmsListener value is being used.
Affects: 4.2.3
Issue Links:
- Support repeatable annotations as composed annotations [SPR-13973] #18545 Support repeatable annotations as composed annotations ("depends on")
- Introduce findRepeatableAnnotations() in AnnotationUtils [SPR-13911] #18485 Introduce findRepeatableAnnotations() in AnnotationUtils
- Use AnnotatedElementUtils instead of AnnotationUtils wherever feasible [SPR-13440] #18020 Use AnnotatedElementUtils instead of AnnotationUtils wherever feasible
- @Value cannot be used as aliased meta-annotation [SPR-13603] #18181
@Valuecannot be used as aliased meta-annotation - Support @Cache* as merged composed annotations [SPR-13475] #18054 Support
@Cache* as merged composed annotations - Support repeatable annotations as composed annotations [SPR-13973] #18545 Support repeatable annotations as composed annotations ("is superseded by")
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issuetype: enhancementA general enhancement
Activity
spring-projects-issues commentedon Dec 17, 2015
Juergen Hoeller commented
I'm not sure there's much we can do about this: According to Java annotation declaration rules, required attributes have to be specified, even when used as meta-annotations.
So I suppose that's just a nuisance (having to specify empty String there on the meta-annotation declaration) but the overriding actually works at runtime?
Juergen
spring-projects-issues commentedon Dec 17, 2015
Grzegorz Poznachowski commented
The thing is that overriding is not working.
spring-projects-issues commentedon Dec 17, 2015
Juergen Hoeller commented
On review, I'm afraid that
@JmsListeneris one of the few places where we do not actually support alias declarations yet, due to the repeatable annotation lookup there. We intend to close such gaps in 4.3.Juergen
spring-projects-issues commentedon Feb 25, 2016
Sam Brannen commented
Please note that this issue has been superseded by #18545.
spring-projects-issues commentedon Mar 26, 2016
Sam Brannen commented
FYI: this has been addressed in #18545, which is now resolved.
For an example of this support in action, consult the following commit:
4742aa0
Just search for
ComposedJmsListenersBeanin the test class.