diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResource.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResource.java index 934490201..2b73b0f5a 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResource.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResource.java @@ -28,8 +28,6 @@ import org.springframework.hateoas.Resources; import org.springframework.hateoas.core.EmbeddedWrapper; import org.springframework.util.Assert; -import com.fasterxml.jackson.annotation.JsonUnwrapped; - /** * A Spring HATEOAS {@link Resource} subclass that holds a reference to the entity's {@link PersistentEntity} metadata. * @@ -38,11 +36,10 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped; */ public class PersistentEntityResource extends Resource { - private static final Resources NO_EMBEDDEDS = new Resources( - Collections. emptyList()); + private static final Iterable NO_EMBEDDEDS = Collections.emptyList(); private final PersistentEntity entity; - private final Resources embeddeds; + private final Iterable embeddeds; /** * Creates a new {@link PersistentEntityResource} for the given {@link PersistentEntity}, content, embedded @@ -54,7 +51,7 @@ public class PersistentEntityResource extends Resource { * @param embeddeds can be {@literal null}. */ private PersistentEntityResource(PersistentEntity entity, Object content, Iterable links, - Resources embeddeds) { + Iterable embeddeds) { super(content, links); @@ -87,8 +84,7 @@ public class PersistentEntityResource extends Resource { * * @return the embeddeds */ - @JsonUnwrapped - public Resources getEmbeddeds() { + public Iterable getEmbeddeds() { return embeddeds; } diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java index 0b9f9226c..6ae3d81e0 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java @@ -43,7 +43,6 @@ import org.springframework.hateoas.EntityLinks; import org.springframework.hateoas.Link; import org.springframework.hateoas.Links; import org.springframework.hateoas.Resource; -import org.springframework.hateoas.Resources; import org.springframework.hateoas.UriTemplate; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -172,7 +171,7 @@ public class PersistentEntityJackson2Module extends SimpleModule { Resource resourceToRender = new Resource(resource.getContent(), links) { @JsonUnwrapped - public Resources getEmbedded() { + public Iterable getEmbedded() { return resource.getEmbeddeds(); } };