diff --git a/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java b/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java index a40cb44ef..18141fcaa 100644 --- a/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java +++ b/src/main/java/org/springframework/hateoas/core/AnnotationMappingDiscoverer.java @@ -108,7 +108,11 @@ public String getMapping(Class type, Method method) { private String[] getMappingFrom(Annotation annotation) { - Object value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName); + Object value = null; + + if (annotation != null) { + value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName); + } if (value instanceof String) { return new String[] { (String) value };