package internal.org.springframework.content.rest.utils;

import org.springframework.content.commons.utils.BeanUtils;

public final class DomainObjectUtils {

    private DomainObjectUtils() {}

    public static final Object getId(Object entity) {

        if (BeanUtils.hasFieldWithAnnotation(entity, javax.persistence.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, javax.persistence.Id.class);
        } else if (BeanUtils.hasFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class);
        }

        return null;
    }
}

@@ -148,24 +148,309 @@
 ectUtils %7B%0A%0A
+    private static boolean JAVAX_PERSISTENCE_ID_CLASS_PRESENT = false;%0A%0A    static %7B%0A        try %7B%0A            JAVAX_PERSISTENCE_ID_CLASS_PRESENT = DomainObjectUtils.class.getClassLoader().loadClass(%22javax.persistence.Id%22) != null;%0A        %7D catch (ClassNotFoundException e) %7B%7D%0A    %7D%0A%0A
     private 
@@ -536,24 +536,62 @@
         if (
+JAVAX_PERSISTENCE_ID_CLASS_PRESENT && 
 BeanUtils.ha

Add class check before attempting to find javax.persistence.Id annotation