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
This commit is contained in:
Christoph Strobl
2022-09-15 11:52:21 +02:00
parent 49b933e9fc
commit 71ad509e79

View File

@@ -23,6 +23,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.data.jpa.domain.support.AuditingBeanFactoryPostProcessor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
@@ -55,5 +56,8 @@ public class JpaRuntimeHints implements RuntimeHintsRegistrar {
hints.reflection().registerType(TypeReference.of(SimpleJpaRepository.class),
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS));
// needs to present for evaluating default attribute values in JpaQueryMethod
hints.reflection().registerType(Query.class, hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
}
}