AnnotationUtils favors local composed annotations over interface annotations and consistently logs introspection failures via lazily initialized logger

Issue: SPR-12355
Issue: SPR-12325
Issue: SPR-12329
This commit is contained in:
Juergen Hoeller
2014-10-20 21:47:47 +02:00
parent 77a62ec8b8
commit 716916b281
2 changed files with 61 additions and 63 deletions

View File

@@ -99,16 +99,15 @@ public class AnnotationUtilsTests {
// assertNotNull(o);
// }
/**
* @since 4.1.2
*/
@Test
public void findAnnotationFavorsInterfacesOverLocalMetaAnnotations() {
public void findAnnotationFavorsLocalMetaAnnotationsOverInterfaces() {
Component component = AnnotationUtils.findAnnotation(
ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface.class, Component.class);
ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface.class, Component.class);
assertNotNull(component);
// By inspecting ClassWithLocalMetaAnnotationAndMetaAnnotatedInterface, one
// might expect that "meta2" should be found; however, with the current
// implementation "meta1" will be found.
assertEquals("meta1", component.value());
assertEquals("meta2", component.value());
}
/**
@@ -116,8 +115,8 @@ public class AnnotationUtilsTests {
*/
@Test
public void findAnnotationFavorsInheritedAnnotationsOverMoreLocallyDeclaredComposedAnnotations() {
Transactional transactional = AnnotationUtils.findAnnotation(SubSubClassWithInheritedAnnotation.class,
Transactional.class);
Transactional transactional = AnnotationUtils.findAnnotation(
SubSubClassWithInheritedAnnotation.class, Transactional.class);
assertNotNull(transactional);
assertTrue("readOnly flag for SubSubClassWithInheritedAnnotation", transactional.readOnly());
}
@@ -127,8 +126,8 @@ public class AnnotationUtilsTests {
*/
@Test
public void findAnnotationFavorsInheritedComposedAnnotationsOverMoreLocallyDeclaredComposedAnnotations() {
Component component = AnnotationUtils.findAnnotation(SubSubClassWithInheritedMetaAnnotation.class,
Component.class);
Component component = AnnotationUtils.findAnnotation(
SubSubClassWithInheritedMetaAnnotation.class, Component.class);
assertNotNull(component);
assertEquals("meta2", component.value());
}