Closed
Description
Phil Webb opened SPR-13973 and commented
Given the following annotations:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MockBeans {
MockBean[] value();
}
@Target({ ElementType.TYPE, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(MockBeans.class)
public @interface MockBean {
@AliasFor("classToMock")
Class<?> value() default Void.class;
@AliasFor("value")
Class<?> classToMock() default Void.class;
}
@Target({ ElementType.TYPE, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@MockBean
public @interface MyMockBean {
@AliasFor(annotation = MockBean.class)
Class<?> value();
}
And the following class:
@MyMockBean(ExampleService.class)
static class MetaMockBean {
}
Calling AnnotationUtils.getRepeatableAnnotations(MetaMockBean.class,MockBean.class, MockBeans.class)
will return a synthesized annotation. However, calling value()
on the result returns Void.class
rather than the expected ExampleService.class
.
Is this expected behavior?
Affects: 4.2.4
Issue Links:
- Support @AliasFor for @JmsListener attributes [SPR-13803] #18376 Support
@AliasFor
for@JmsListener
attributes ("is depended on by") - Support multiple composed annotations on a single annotated element [SPR-13486] #17490 Support multiple composed annotations on a single annotated element
- Support @Cache* as merged composed annotations [SPR-13475] #18054 Support
@Cache
* as merged composed annotations - Introduce findRepeatableAnnotations() in AnnotationUtils [SPR-13911] #18485 Introduce findRepeatableAnnotations() in AnnotationUtils ("supersedes")
- Support @AliasFor for @JmsListener attributes [SPR-13803] #18376 Support
@AliasFor
for@JmsListener
attributes ("supersedes")
Referenced from: commits 4836d06, 46e0484, 2ed3382, b0c6357, c6f6e19, 3597879, d572b02, 2535469, 4fa11e3, c6b1f38, 4742aa0, b6d9fd3