2424import org .springframework .aot .hint .TypeReference ;
2525import org .springframework .beans .factory .BeanFactory ;
2626import org .springframework .core .io .InputStreamSource ;
27+ import org .springframework .data .domain .Example ;
2728import org .springframework .data .mapping .context .MappingContext ;
29+ import org .springframework .data .querydsl .QuerydslPredicateExecutor ;
30+ import org .springframework .data .querydsl .QuerydslUtils ;
31+ import org .springframework .data .querydsl .ReactiveQuerydslPredicateExecutor ;
2832import org .springframework .data .repository .core .RepositoryMetadata ;
2933import org .springframework .data .repository .core .support .RepositoryFactoryBeanSupport ;
3034import org .springframework .data .repository .core .support .RepositoryFragment ;
3438import org .springframework .data .repository .query .FluentQuery .FetchableFluentQuery ;
3539import org .springframework .data .repository .query .FluentQuery .ReactiveFluentQuery ;
3640import org .springframework .data .repository .query .QueryByExampleExecutor ;
41+ import org .springframework .data .repository .query .ReactiveQueryByExampleExecutor ;
3742import org .springframework .lang .Nullable ;
43+ import org .springframework .util .ClassUtils ;
44+
45+ import com .querydsl .core .types .Predicate ;
3846
3947/**
4048 * {@link RuntimeHintsRegistrar} holding required hints to bootstrap data repositories. <br />
4149 * Already registered via {@literal aot.factories}.
4250 *
4351 * @author Christoph Strobl
52+ * @author Mark Paluch
4453 * @since 3.0
4554 */
4655class RepositoryRuntimeHints implements RuntimeHintsRegistrar {
4756
57+ private static final boolean PROJECT_REACTOR_PRESENT = ClassUtils .isPresent ("reactor.core.publisher.Flux" ,
58+ RepositoryRuntimeHints .class .getClassLoader ());
59+
4860 @ Override
4961 public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
5062
@@ -54,16 +66,45 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
5466 TypeReference .of (RepositoryFragmentsFactoryBean .class ), //
5567 TypeReference .of (RepositoryFragment .class ), //
5668 TypeReference .of (TransactionalRepositoryFactoryBeanSupport .class ), //
69+ TypeReference .of (Example .class ), //
5770 TypeReference .of (QueryByExampleExecutor .class ), //
5871 TypeReference .of (MappingContext .class ), //
5972 TypeReference .of (RepositoryMetadata .class ), //
6073 TypeReference .of (FluentQuery .class ), //
61- TypeReference .of (FetchableFluentQuery .class ), //
62- TypeReference .of (ReactiveFluentQuery .class ) //
74+ TypeReference .of (FetchableFluentQuery .class ) //
6375 ), builder -> {
6476 builder .withMembers (MemberCategory .INVOKE_PUBLIC_METHODS );
6577 });
6678
79+ if (PROJECT_REACTOR_PRESENT ) {
80+
81+ // repository infrastructure
82+ hints .reflection ().registerTypes (Arrays .asList ( //
83+ TypeReference .of (ReactiveFluentQuery .class ), //
84+ TypeReference .of (ReactiveQueryByExampleExecutor .class )), //
85+ builder -> {
86+ builder .withMembers (MemberCategory .INVOKE_PUBLIC_METHODS );
87+ });
88+ }
89+
90+ if (QuerydslUtils .QUERY_DSL_PRESENT ) {
91+
92+ // repository infrastructure
93+ hints .reflection ().registerTypes (Arrays .asList ( //
94+ TypeReference .of (Predicate .class ), //
95+ TypeReference .of (QuerydslPredicateExecutor .class )), builder -> {
96+ builder .withMembers (MemberCategory .INVOKE_PUBLIC_METHODS );
97+ });
98+
99+ if (PROJECT_REACTOR_PRESENT ) {
100+ // repository infrastructure
101+ hints .reflection ().registerTypes (Arrays .asList ( //
102+ TypeReference .of (ReactiveQuerydslPredicateExecutor .class )), builder -> {
103+ builder .withMembers (MemberCategory .INVOKE_PUBLIC_METHODS );
104+ });
105+ }
106+ }
107+
67108 // named queries
68109 hints .reflection ().registerTypes (Arrays .asList ( //
69110 TypeReference .of (Properties .class ), //
0 commit comments