diff --git a/src/main/java/org/springframework/data/aot/AotContext.java b/src/main/java/org/springframework/data/aot/AotContext.java
index fcd666c43..86261fb49 100644
--- a/src/main/java/org/springframework/data/aot/AotContext.java
+++ b/src/main/java/org/springframework/data/aot/AotContext.java
@@ -35,8 +35,8 @@ import org.springframework.util.Assert;
/**
* The context in which the AOT processing happens. Grants access to the {@link ConfigurableListableBeanFactory
* beanFactory} and {@link ClassLoader}. Holds a few convenience methods to check if a type
- * {@link #isTypePresent(String) is present} and allows resolution of them throug {@link TypeIntrospector} and
- * {@link IntrospectedBeanDefinition}.
+ * {@link TypeIntrospector#isTypePresent() is present} and allows resolution of them through {@link TypeIntrospector}
+ * and {@link IntrospectedBeanDefinition}.
*
* Mainly for internal use within the framework.
*
diff --git a/src/main/java/org/springframework/data/aot/Predicates.java b/src/main/java/org/springframework/data/aot/Predicates.java
index 30b8cabc1..076613c7f 100644
--- a/src/main/java/org/springframework/data/aot/Predicates.java
+++ b/src/main/java/org/springframework/data/aot/Predicates.java
@@ -44,6 +44,7 @@ public abstract class Predicates {
public static final Predicate IS_PROTECTED = member -> Modifier.isProtected(member.getModifiers());
public static final Predicate IS_PUBLIC = member -> Modifier.isPublic(member.getModifiers());
public static final Predicate IS_SYNTHETIC = Member::isSynthetic;
+ public static final Predicate IS_STATIC = member -> Modifier.isStatic(member.getModifiers());
public static final Predicate IS_BRIDGE_METHOD = Method::isBridge;
diff --git a/src/main/java/org/springframework/data/aot/TypeCollector.java b/src/main/java/org/springframework/data/aot/TypeCollector.java
index b4c0b255d..db68ed9da 100644
--- a/src/main/java/org/springframework/data/aot/TypeCollector.java
+++ b/src/main/java/org/springframework/data/aot/TypeCollector.java
@@ -51,7 +51,8 @@ public class TypeCollector {
private static final Log logger = LogFactory.getLog(TypeCollector.class);
static final Set EXCLUDED_DOMAINS = new HashSet<>(Arrays.asList("java", "sun.", "jdk.", "reactor.",
- "kotlinx.", "kotlin.", "org.springframework.core.", "org.springframework.boot."));
+ "kotlinx.", "kotlin.", "org.springframework.core.", "org.springframework.data.mapping.",
+ "org.springframework.data.repository.", "org.springframework.boot.", "org.springframework.core."));
private final Predicate> excludedDomainsFilter = type -> {
String packageName = type.getPackageName();
@@ -60,34 +61,9 @@ public class TypeCollector {
private Predicate> typeFilter = excludedDomainsFilter;
- private final Predicate methodFilter = method -> {
+ private final Predicate methodFilter = createMethodFilter();
- // TODO: Eagerly construct predicate objects to avoid object allocations during test(…)
- Predicate excludedDomainsPredicate = methodToTest -> excludedDomainsFilter
- .test(methodToTest.getDeclaringClass());
-
- Predicate excludedMethodsPredicate = Predicates.IS_BRIDGE_METHOD //
- .or(Predicates.IS_OBJECT_MEMBER) //
- .or(Predicates.IS_HIBERNATE_MEMBER) //
- .or(Predicates.IS_ENUM_MEMBER) //
- .or(Predicates.IS_NATIVE) //
- .or(Predicates.IS_PRIVATE) //
- .or(Predicates.IS_PROTECTED) //
- .or(Predicates.IS_SYNTHETIC) //
- .or(excludedDomainsPredicate.negate()); //
-
- return !excludedMethodsPredicate.test(method);
- };
-
- private Predicate fieldFilter = field -> {
-
- // TODO: Eagerly construct predicate objects to avoid object allocations during test(…)
- Predicate excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER //
- .or(Predicates.IS_SYNTHETIC) //
- .or(Predicates.IS_JAVA);
-
- return !excludedFieldPredicate.test(field);
- };
+ private Predicate fieldFilter = createFieldFilter();
public TypeCollector filterFields(Predicate filter) {
this.fieldFilter = filter.and(filter);
@@ -198,6 +174,35 @@ public class TypeCollector {
return discoveredTypes;
}
+ private Predicate createMethodFilter() {
+
+ Predicate excludedDomainsPredicate = methodToTest -> excludedDomainsFilter
+ .test(methodToTest.getDeclaringClass());
+
+ Predicate excludedMethodsPredicate = Predicates.IS_BRIDGE_METHOD //
+ .or(Predicates.IS_STATIC) //
+ .or(Predicates.IS_SYNTHETIC) //
+ .or(Predicates.IS_NATIVE) //
+ .or(Predicates.IS_PRIVATE) //
+ .or(Predicates.IS_PROTECTED) //
+ .or(Predicates.IS_OBJECT_MEMBER) //
+ .or(Predicates.IS_HIBERNATE_MEMBER) //
+ .or(Predicates.IS_ENUM_MEMBER) //
+ .or(excludedDomainsPredicate.negate()); //
+
+ return excludedMethodsPredicate.negate();
+ }
+
+ @SuppressWarnings("rawtypes")
+ private Predicate createFieldFilter() {
+
+ Predicate excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER //
+ .or(Predicates.IS_SYNTHETIC) //
+ .or(Predicates.IS_JAVA);
+
+ return (Predicate) excludedFieldPredicate.negate();
+ }
+
public static class ReachableTypes {
private final Iterable> roots;
diff --git a/src/main/resources/META-INF/spring/aot.factories b/src/main/resources/META-INF/spring/aot.factories
index bb9825009..7377c7b80 100644
--- a/src/main/resources/META-INF/spring/aot.factories
+++ b/src/main/resources/META-INF/spring/aot.factories
@@ -1,6 +1,8 @@
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
org.springframework.data.aot.SpringDataBeanFactoryInitializationAotProcessor
+
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.data.aot.hint.RepositoryRuntimeHints
+
org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\
org.springframework.data.aot.AuditingBeanRegistrationAotProcessor