Skip to content

Commit 71ad509

Browse files
Add runtime hint for repository Query annotation.
The annotations default values are evaluated so we need it to be present no matter if used or not. See: #2497
1 parent 49b933e commit 71ad509

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/aot/JpaRuntimeHints.java

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.aot.hint.TypeReference;
2424
import org.springframework.data.jpa.domain.support.AuditingBeanFactoryPostProcessor;
2525
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
26+
import org.springframework.data.jpa.repository.Query;
2627
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
2728
import org.springframework.lang.Nullable;
2829
import org.springframework.util.ClassUtils;
@@ -55,5 +56,8 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
5556

5657
hints.reflection().registerType(TypeReference.of(SimpleJpaRepository.class),
5758
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS));
59+
60+
// needs to present for evaluating default attribute values in JpaQueryMethod
61+
hints.reflection().registerType(Query.class, hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
5862
}
5963
}

0 commit comments

Comments
 (0)