Add missing runtime hints for ReactiveBeforeBindCallback

See #2798.
This commit is contained in:
Michael Simons
2023-09-22 12:43:08 +02:00
parent 175cc34843
commit 86497dfa67

View File

@@ -21,10 +21,17 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.data.neo4j.core.mapping.callback.AfterConvertCallback;
import org.springframework.data.neo4j.core.mapping.callback.BeforeBindCallback;
import org.springframework.data.neo4j.core.mapping.callback.ReactiveBeforeBindCallback;
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 +58,31 @@ 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(SimpleReactiveNeo4jRepository.class),
TypeReference.of(SimpleReactiveQueryByExampleExecutor.class),
TypeReference.of(ReactiveBeforeBindCallback.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);
}
}
}