From ce72f4de7f3759cbddfcd3b7968247feb717bb6e Mon Sep 17 00:00:00 2001 From: Gerrit Meier Date: Thu, 18 May 2023 11:16:08 +0200 Subject: [PATCH] GH-2725 - Add missing runtime hints. --- .../data/neo4j/aot/Neo4jRuntimeHints.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main/java/org/springframework/data/neo4j/aot/Neo4jRuntimeHints.java b/src/main/java/org/springframework/data/neo4j/aot/Neo4jRuntimeHints.java index f17b6db05..ddb5f9a42 100644 --- a/src/main/java/org/springframework/data/neo4j/aot/Neo4jRuntimeHints.java +++ b/src/main/java/org/springframework/data/neo4j/aot/Neo4jRuntimeHints.java @@ -23,8 +23,14 @@ import org.springframework.data.neo4j.core.mapping.callback.AfterConvertCallback import org.springframework.data.neo4j.core.mapping.callback.BeforeBindCallback; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.support.UUIDStringGenerator; +import org.springframework.data.neo4j.repository.query.QuerydslNeo4jPredicateExecutor; +import org.springframework.data.neo4j.repository.query.ReactiveQuerydslNeo4jPredicateExecutor; import org.springframework.data.neo4j.repository.query.SimpleQueryByExampleExecutor; +import org.springframework.data.neo4j.repository.query.SimpleReactiveQueryByExampleExecutor; import org.springframework.data.neo4j.repository.support.SimpleNeo4jRepository; +import org.springframework.data.neo4j.repository.support.SimpleReactiveNeo4jRepository; +import org.springframework.data.querydsl.QuerydslUtils; +import org.springframework.data.util.ReactiveWrappers; import org.springframework.lang.Nullable; import java.util.Arrays; @@ -51,5 +57,30 @@ public class Neo4jRuntimeHints implements RuntimeHintsRegistrar { ), builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS)); + + if (ReactiveWrappers.isAvailable(ReactiveWrappers.ReactiveLibrary.PROJECT_REACTOR)) { + hints.reflection().registerTypes( + Arrays.asList( + TypeReference.of(SimpleReactiveQueryByExampleExecutor.class), + TypeReference.of(SimpleReactiveNeo4jRepository.class) + ), + builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS)); + } + + if (QuerydslUtils.QUERY_DSL_PRESENT) { + registerQuerydslHints(hints); + } + } + + private static void registerQuerydslHints(RuntimeHints hints) { + + hints.reflection().registerType(QuerydslNeo4jPredicateExecutor.class, + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); + + if (ReactiveWrappers.isAvailable(ReactiveWrappers.ReactiveLibrary.PROJECT_REACTOR)) { + hints.reflection().registerType(ReactiveQuerydslNeo4jPredicateExecutor.class, + MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); + } + } }