From 97952d1a6fc6246e72612e2d95de081073f2a655 Mon Sep 17 00:00:00 2001 From: Greg Turnquist Date: Fri, 29 May 2015 15:58:27 -0500 Subject: [PATCH] DATAREST-550 - Specify more details about excerpts and projections * Point out that excerpts are ONLY applied to collections. * How projections can be found via annotation or manually registered --- src/main/asciidoc/projections-excerpts.adoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/asciidoc/projections-excerpts.adoc b/src/main/asciidoc/projections-excerpts.adoc index 8a9c69c16..bfa5eb13d 100644 --- a/src/main/asciidoc/projections-excerpts.adoc +++ b/src/main/asciidoc/projections-excerpts.adoc @@ -173,6 +173,14 @@ Spring Data REST exposes <> documents, a micro metadata format. T <3> Further down you can see projection `noAddresses` listed. <4> The actual attributes served up by this projection include `firstName` and `lastName`. +[NOTE] +==== +Projection definitions will be picked up and made available for clients if they are: + +* Flagged with the `@Projection` annotation and located in the same package (or sub-package) of the domain type, OR +* Manually registered via `RepositoryRestConfiguration.projectionConfiguration().addProjection(…)`. +==== + [[projections-excerpts.hidden-data]] === Bringing in hidden data @@ -257,7 +265,7 @@ interface PersonRepository extends CrudRepository {} This directs Spring Data REST to use the `NoAddresses` projection when embedding `Person` resources into collections or related resources. -NOTE: Excerpt projections to a single resource automatically. They have to be applied deliberately. +NOTE: Excerpt projections are *NOT* applied to _single resources_ automatically. They have to be applied deliberately. Excerpt projections are meant to provide a default preview of collection data, but not when fetching individual resources. See http://stackoverflow.com/questions/30220333/why-is-an-excerpt-projection-not-applied-automatically-for-a-spring-data-rest-it[Why is an excerpt projection not applied automatically for a Spring Data REST item resource?] for a discussion on the subject. In addition to altering the default rendering, excerpts have additional rendering options as shown below.