From bb3ed0add10201269e2977e801f7b14cfbbb890a Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 11 Feb 2021 18:50:39 +0100 Subject: [PATCH] #1456 - Properly detect Validation API in 2.0 or newer. We now check for the presence of @Email to detect validation API in 2.0 or better. --- .../org/springframework/hateoas/mediatype/PropertyUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java b/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java index c503bef0..af9ee99f 100644 --- a/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java +++ b/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java @@ -68,7 +68,7 @@ public class PropertyUtils { private static final Map DOMAIN_TYPE_CACHE = new ConcurrentReferenceHashMap<>(); private static final Map METADATA_CACHE = new ConcurrentReferenceHashMap<>(); private static final Set FIELDS_TO_IGNORE = new HashSet<>(Arrays.asList("class", "links")); - private static final boolean JSR_303_PRESENT = ClassUtils.isPresent("javax.validation.Valid", + private static final boolean JSR_303_PRESENT = ClassUtils.isPresent("javax.validation.constraints.Email", PropertyUtils.class.getClassLoader()); private static final List> TYPES_TO_UNWRAP = new ArrayList<>( Arrays.asList(EntityModel.class, CollectionModel.class, HttpEntity.class));