Skip to content

Commit f45f534

Browse files
christophstroblgregturn
authored andcommitted
Add missing reflection configuration for AbstractPersistable & -Auditable.
Resolves #2735.
1 parent 31db4aa commit f45f534

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919

2020
import java.util.Arrays;
2121
import java.util.Collections;
22+
import java.util.List;
2223

2324
import org.springframework.aot.hint.ExecutableMode;
2425
import org.springframework.aot.hint.MemberCategory;
2526
import org.springframework.aot.hint.RuntimeHints;
2627
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2728
import org.springframework.aot.hint.TypeReference;
29+
import org.springframework.data.jpa.domain.AbstractAuditable;
30+
import org.springframework.data.jpa.domain.AbstractPersistable;
2831
import org.springframework.data.jpa.domain.support.AuditingBeanFactoryPostProcessor;
2932
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
3033
import org.springframework.data.jpa.repository.EntityGraph;
@@ -71,6 +74,11 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
7174
// needs to present for evaluating default attribute values in JpaQueryMethod
7275
hints.reflection().registerType(Query.class, hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
7376

77+
// make sure annotations on the fields are visible and allow reflection on protected methods
78+
hints.reflection().registerTypes(
79+
List.of(TypeReference.of(AbstractPersistable.class), TypeReference.of(AbstractAuditable.class)),
80+
hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS));
81+
7482
if (QuerydslUtils.QUERY_DSL_PRESENT) {
7583

7684
hints.reflection().registerType(QuerydslJpaPredicateExecutor.class,

0 commit comments

Comments
 (0)