Use BindingReflectionHintsRegistrar to add reflection hints on types.
Closes: #2683 Original pull request: #2684.
This commit is contained in:
committed by
Mark Paluch
parent
9c993e22f5
commit
9e9ddbf334
@@ -268,10 +268,9 @@ public class RepositoryRegistrationAotContribution implements BeanRegistrationAo
|
||||
.registerType(repositoryInformation.getRepositoryInterface(),
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS))
|
||||
.registerType(repositoryInformation.getRepositoryBaseClass(),
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS))
|
||||
.registerType(repositoryInformation.getDomainType(),
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
|
||||
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||
|
||||
TypeContributor.contribute(repositoryInformation.getDomainType(), contribution);
|
||||
|
||||
// Repository Fragments
|
||||
for (RepositoryFragment<?> fragment : getRepositoryInformation().getFragments()) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.aot.generate.GenerationContext;
|
||||
import org.springframework.aot.hint.BindingReflectionHintsRegistrar;
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.core.annotation.MergedAnnotation;
|
||||
|
||||
@@ -31,6 +32,7 @@ import org.springframework.core.annotation.MergedAnnotation;
|
||||
public class TypeContributor {
|
||||
|
||||
public static final String DATA_NAMESPACE = "org.springframework.data";
|
||||
public static final BindingReflectionHintsRegistrar REGISTRAR = new BindingReflectionHintsRegistrar();
|
||||
|
||||
/**
|
||||
* Contribute the type with default reflection configuration, skip annotations.
|
||||
@@ -65,15 +67,7 @@ public class TypeContributor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type.isInterface()) {
|
||||
contribution.getRuntimeHints().reflection().registerType(type,
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||
return;
|
||||
}
|
||||
|
||||
contribution.getRuntimeHints().reflection().registerType(type,
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS,
|
||||
MemberCategory.DECLARED_FIELDS));
|
||||
REGISTRAR.registerReflectionHints(contribution.getRuntimeHints().reflection(), type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user