From d4dea42509b278268d4c5d77c1df015c10bbdc8c Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 25 Jan 2022 09:50:29 +0100 Subject: [PATCH] Document dynamic projections parameter detection. Closes #2510 --- src/main/asciidoc/repository-projections.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/asciidoc/repository-projections.adoc b/src/main/asciidoc/repository-projections.adoc index c833520d5..3a1c2ad2b 100644 --- a/src/main/asciidoc/repository-projections.adoc +++ b/src/main/asciidoc/repository-projections.adoc @@ -304,7 +304,7 @@ This way, the method can be used to obtain the aggregates as is or with a projec .Using a repository with dynamic projections ==== -[source, java, subs="+attributes"] +[source,java,subs="+attributes"] ---- void someMethod(PersonRepository people) { @@ -316,3 +316,7 @@ void someMethod(PersonRepository people) { } ---- ==== + +NOTE: Query parameters of type `Class` are inspected whether they qualify as dynamic projection parameter. +If the actual return type of the query equals the generic parameter type of the `Class` parameter, then the matching `Class` parameter is not available for usage within the query or SpEL expressions. +If you want to use a `Class` parameter as query argument then make sure to use a different generic parameter, for example `Class`.