Merge branch '1.5.x'

This commit is contained in:
Andy Wilkinson 2017-08-09 11:46:53 +01:00
commit 66f9696a44
2 changed files with 16 additions and 10 deletions

View File

@ -85,12 +85,15 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
private List<Annotation> getMergedAnnotations(Class<?> root, Class<?> source) {
List<Annotation> mergedAnnotations = new ArrayList<>();
for (Annotation annotation : AnnotationUtils.getAnnotations(source)) {
Annotation[] annotations = AnnotationUtils.getAnnotations(source);
if (annotations != null) {
for (Annotation annotation : annotations) {
if (!AnnotationUtils.isInJavaLangAnnotationPackage(annotation)) {
mergedAnnotations
.add(findMergedAnnotation(root, annotation.annotationType()));
}
}
}
return mergedAnnotations;
}

View File

@ -79,7 +79,9 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
Set<Class<?>> components = new LinkedHashSet<>();
Set<Class<?>> propertyMappings = new LinkedHashSet<>();
while (beanClass != null) {
for (Annotation annotation : AnnotationUtils.getAnnotations(beanClass)) {
Annotation[] annotations = AnnotationUtils.getAnnotations(beanClass);
if (annotations != null) {
for (Annotation annotation : annotations) {
if (isAnnotated(annotation, Component.class)) {
components.add(annotation.annotationType());
}
@ -87,6 +89,7 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
propertyMappings.add(annotation.annotationType());
}
}
}
beanClass = beanClass.getSuperclass();
}
if (!components.isEmpty() && !propertyMappings.isEmpty()) {