diff --git a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java index 32418b678..9d7fd25f0 100644 --- a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java +++ b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java @@ -82,7 +82,7 @@ public abstract class AnnotationBasedPersistentProperty
annotationType = annotation.annotationType(); - if (annotationCache.containsKey(annotationType)) { + if (annotationCache.containsKey(annotationType) && !annotationCache.get(annotationType).equals(annotation)) { throw new MappingException(String.format("Ambiguous mapping! Annotation %s configured " + "multiple times on accessor methods of property %s in class %s!", annotationType, getName(), getOwner() .getType().getName())); diff --git a/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java b/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java index 1d5627e91..c284f9fff 100644 --- a/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java +++ b/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java @@ -136,6 +136,7 @@ public class AbstractAnnotationBasedPropertyUnitTests