diff --git a/src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java b/src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java index 48bc6dc22..c1a0ae998 100644 --- a/src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java +++ b/src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java @@ -31,6 +31,8 @@ import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.ResolvableType; import org.springframework.data.domain.ManagedTypes; +import org.springframework.data.util.TypeContributor; +import org.springframework.data.util.TypeUtils; import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; diff --git a/src/main/java/org/springframework/data/aot/ManagedTypesRegistrationAotContribution.java b/src/main/java/org/springframework/data/aot/ManagedTypesRegistrationAotContribution.java index 20706d6fc..d2da097b1 100644 --- a/src/main/java/org/springframework/data/aot/ManagedTypesRegistrationAotContribution.java +++ b/src/main/java/org/springframework/data/aot/ManagedTypesRegistrationAotContribution.java @@ -35,6 +35,7 @@ import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.core.ResolvableType; import org.springframework.data.domain.ManagedTypes; import org.springframework.data.util.Lazy; +import org.springframework.data.util.TypeCollector; import org.springframework.javapoet.ClassName; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec.Builder; diff --git a/src/main/java/org/springframework/data/aot/Predicates.java b/src/main/java/org/springframework/data/aot/Predicates.java deleted file mode 100644 index 076613c7f..000000000 --- a/src/main/java/org/springframework/data/aot/Predicates.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.aot; - -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.function.Predicate; - -/** - * Abstract utility class containing common, reusable {@link Predicate Predicates}. - * - * @author John Blum - * @see java.util.function.Predicate - * @since 3.0 - */ -// TODO: Consider moving to the org.springframework.data.util package. -@SuppressWarnings("unused") -public abstract class Predicates { - - public static final Predicate IS_ENUM_MEMBER = member -> member.getDeclaringClass().isEnum(); - public static final Predicate IS_HIBERNATE_MEMBER = member -> member.getName().startsWith("$$_hibernate"); // this - // should - // go - // into - // JPA - public static final Predicate IS_OBJECT_MEMBER = member -> Object.class.equals(member.getDeclaringClass()); - public static final Predicate IS_JAVA = member -> member.getDeclaringClass().getPackageName().startsWith("java."); - public static final Predicate IS_NATIVE = member -> Modifier.isNative(member.getModifiers()); - public static final Predicate IS_PRIVATE = member -> Modifier.isPrivate(member.getModifiers()); - 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/querydsl/aot/QuerydslHints.java b/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java new file mode 100644 index 000000000..bb7d4c6a5 --- /dev/null +++ b/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.data.querydsl.aot; + +import java.util.Arrays; + +import org.springframework.aot.hint.MemberCategory; +import org.springframework.aot.hint.RuntimeHints; +import org.springframework.aot.hint.RuntimeHintsRegistrar; +import org.springframework.aot.hint.TypeReference; +import org.springframework.data.querydsl.QuerydslPredicateExecutor; +import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor; +import org.springframework.lang.Nullable; +import org.springframework.util.ClassUtils; + +import com.querydsl.core.types.Predicate; + +/** + * @author Christoph Strobl + * @since 4.0 + */ +public class QuerydslHints implements RuntimeHintsRegistrar { + + @Override + public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { + + if (ClassUtils.isPresent("com.querydsl.core.types.Predicate", classLoader)) { + + // repository infrastructure + hints.reflection().registerTypes(Arrays.asList( // + TypeReference.of(Predicate.class), // + TypeReference.of(QuerydslPredicateExecutor.class)), builder -> { + builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS); + }); + + if (ClassUtils.isPresent("reactor.core.publisher.Flux", classLoader)) { + // repository infrastructure + hints.reflection().registerTypes(Arrays.asList( // + TypeReference.of(ReactiveQuerydslPredicateExecutor.class)), builder -> { + builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS); + }); + } + } + } +} diff --git a/src/main/java/org/springframework/data/repository/aot/hint/RepositoryRuntimeHints.java b/src/main/java/org/springframework/data/repository/aot/hint/RepositoryRuntimeHints.java index 568e02d7b..20209798a 100644 --- a/src/main/java/org/springframework/data/repository/aot/hint/RepositoryRuntimeHints.java +++ b/src/main/java/org/springframework/data/repository/aot/hint/RepositoryRuntimeHints.java @@ -26,9 +26,6 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.core.io.InputStreamSource; import org.springframework.data.domain.Example; import org.springframework.data.mapping.context.MappingContext; -import org.springframework.data.querydsl.QuerydslPredicateExecutor; -import org.springframework.data.querydsl.QuerydslUtils; -import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; import org.springframework.data.repository.core.support.RepositoryFragment; @@ -42,8 +39,6 @@ import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor; import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; -import com.querydsl.core.types.Predicate; - /** * {@link RuntimeHintsRegistrar} holding required hints to bootstrap data repositories.
* Already registered via {@literal aot.factories}. @@ -87,24 +82,6 @@ class RepositoryRuntimeHints implements RuntimeHintsRegistrar { }); } - if (QuerydslUtils.QUERY_DSL_PRESENT) { - - // repository infrastructure - hints.reflection().registerTypes(Arrays.asList( // - TypeReference.of(Predicate.class), // - TypeReference.of(QuerydslPredicateExecutor.class)), builder -> { - builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS); - }); - - if (PROJECT_REACTOR_PRESENT) { - // repository infrastructure - hints.reflection().registerTypes(Arrays.asList( // - TypeReference.of(ReactiveQuerydslPredicateExecutor.class)), builder -> { - builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS); - }); - } - } - // named queries hints.reflection().registerTypes(Arrays.asList( // TypeReference.of(Properties.class), // diff --git a/src/main/java/org/springframework/data/repository/aot/AotRepositoryContext.java b/src/main/java/org/springframework/data/repository/config/AotRepositoryContext.java similarity index 97% rename from src/main/java/org/springframework/data/repository/aot/AotRepositoryContext.java rename to src/main/java/org/springframework/data/repository/config/AotRepositoryContext.java index ad96f189c..b7eee926c 100644 --- a/src/main/java/org/springframework/data/repository/aot/AotRepositoryContext.java +++ b/src/main/java/org/springframework/data/repository/config/AotRepositoryContext.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.lang.annotation.Annotation; import java.util.Set; diff --git a/src/main/java/org/springframework/data/repository/aot/AotRepositoryInformation.java b/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java similarity index 62% rename from src/main/java/org/springframework/data/repository/aot/AotRepositoryInformation.java rename to src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java index 8f3c2b078..602edbb5f 100644 --- a/src/main/java/org/springframework/data/repository/aot/AotRepositoryInformation.java +++ b/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java @@ -1,3 +1,35 @@ +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* * Copyright 2022 the original author or authors. * @@ -13,7 +45,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.lang.reflect.Method; import java.util.Collection; diff --git a/src/main/java/org/springframework/data/repository/aot/DefaultAotRepositoryContext.java b/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java similarity index 75% rename from src/main/java/org/springframework/data/repository/aot/DefaultAotRepositoryContext.java rename to src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java index 60888bdb0..1ffbc7a5c 100644 --- a/src/main/java/org/springframework/data/repository/aot/DefaultAotRepositoryContext.java +++ b/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java @@ -1,3 +1,35 @@ +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* * Copyright 2022 the original author or authors. * @@ -13,7 +45,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.lang.annotation.Annotation; import java.util.LinkedHashSet; @@ -23,8 +55,9 @@ import java.util.stream.Collectors; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.core.annotation.MergedAnnotation; import org.springframework.data.aot.AotContext; -import org.springframework.data.aot.TypeCollector; -import org.springframework.data.aot.TypeUtils; +import org.springframework.data.repository.config.AotRepositoryContext; +import org.springframework.data.util.TypeCollector; +import org.springframework.data.util.TypeUtils; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.util.Lazy; diff --git a/src/main/java/org/springframework/data/repository/aot/RepositoryBeanDefinitionReader.java b/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java similarity index 73% rename from src/main/java/org/springframework/data/repository/aot/RepositoryBeanDefinitionReader.java rename to src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java index a013dbeb8..5ba767e86 100644 --- a/src/main/java/org/springframework/data/repository/aot/RepositoryBeanDefinitionReader.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java @@ -1,3 +1,35 @@ +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright 2022. the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* * Copyright 2022 the original author or authors. * @@ -13,7 +45,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.util.ArrayList; import java.util.Collection; @@ -23,8 +55,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.data.repository.config.RepositoryConfiguration; -import org.springframework.data.repository.config.RepositoryFragmentConfigurationProvider; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.support.DefaultRepositoryMetadata; import org.springframework.data.repository.core.support.RepositoryFragment; diff --git a/src/main/java/org/springframework/data/repository/config/RepositoryConfigurationExtension.java b/src/main/java/org/springframework/data/repository/config/RepositoryConfigurationExtension.java index e7ab33fd6..8d34b8b04 100644 --- a/src/main/java/org/springframework/data/repository/config/RepositoryConfigurationExtension.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryConfigurationExtension.java @@ -23,7 +23,6 @@ import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.core.io.ResourceLoader; -import org.springframework.data.repository.aot.RepositoryRegistrationAotProcessor; import org.springframework.lang.NonNull; /** diff --git a/src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContribution.java b/src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotContribution.java similarity index 98% rename from src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContribution.java rename to src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotContribution.java index 107aaa4f3..2c72ddc73 100644 --- a/src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContribution.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotContribution.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.io.Serializable; import java.lang.annotation.Annotation; @@ -42,13 +42,11 @@ import org.springframework.core.DecoratingProxy; import org.springframework.core.ResolvableType; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.data.aot.AotContext; -import org.springframework.data.aot.TypeContributor; -import org.springframework.data.aot.TypeUtils; +import org.springframework.data.util.TypeContributor; +import org.springframework.data.util.TypeUtils; import org.springframework.data.projection.EntityProjectionIntrospector; import org.springframework.data.projection.TargetAware; import org.springframework.data.repository.Repository; -import org.springframework.data.repository.config.RepositoryConfiguration; -import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; import org.springframework.data.repository.core.support.RepositoryFragment; diff --git a/src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessor.java b/src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotProcessor.java similarity index 96% rename from src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessor.java rename to src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotProcessor.java index 7a562e770..3184ae28a 100644 --- a/src/main/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessor.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryRegistrationAotProcessor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.repository.aot; +package org.springframework.data.repository.config; import java.lang.annotation.Annotation; import java.util.Collections; @@ -35,9 +35,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.annotation.MergedAnnotation; -import org.springframework.data.aot.TypeContributor; -import org.springframework.data.repository.config.RepositoryConfiguration; -import org.springframework.data.repository.config.RepositoryConfigurationExtension; +import org.springframework.data.util.TypeContributor; import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; import org.springframework.lang.Nullable; import org.springframework.util.Assert; diff --git a/src/main/java/org/springframework/data/util/Predicates.java b/src/main/java/org/springframework/data/util/Predicates.java index fecb85925..f153bc2be 100644 --- a/src/main/java/org/springframework/data/util/Predicates.java +++ b/src/main/java/org/springframework/data/util/Predicates.java @@ -15,6 +15,9 @@ */ package org.springframework.data.util; +import java.lang.reflect.Member; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.util.function.Predicate; import org.springframework.util.Assert; @@ -27,6 +30,23 @@ import org.springframework.util.Assert; */ public interface Predicates { + public static final Predicate IS_ENUM_MEMBER = member -> member.getDeclaringClass().isEnum(); + public static final Predicate IS_HIBERNATE_MEMBER = member -> member.getName().startsWith("$$_hibernate"); // this + // should + // go + // into + // JPA + public static final Predicate IS_OBJECT_MEMBER = member -> Object.class.equals(member.getDeclaringClass()); + public static final Predicate IS_JAVA = member -> member.getDeclaringClass().getPackageName().startsWith("java."); + public static final Predicate IS_NATIVE = member -> Modifier.isNative(member.getModifiers()); + public static final Predicate IS_PRIVATE = member -> Modifier.isPrivate(member.getModifiers()); + 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; + /** * A {@link Predicate} that yields always {@code true}. * diff --git a/src/main/java/org/springframework/data/aot/TypeCollector.java b/src/main/java/org/springframework/data/util/TypeCollector.java similarity index 89% rename from src/main/java/org/springframework/data/aot/TypeCollector.java rename to src/main/java/org/springframework/data/util/TypeCollector.java index db68ed9da..a121d8521 100644 --- a/src/main/java/org/springframework/data/aot/TypeCollector.java +++ b/src/main/java/org/springframework/data/util/TypeCollector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.aot; +package org.springframework.data.util; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -37,7 +37,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.ResolvableType; -import org.springframework.data.util.Lazy; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; @@ -179,15 +178,15 @@ public class TypeCollector { 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) // + Predicate excludedMethodsPredicate = org.springframework.data.util.Predicates.IS_BRIDGE_METHOD // + .or(org.springframework.data.util.Predicates.IS_STATIC) // + .or(org.springframework.data.util.Predicates.IS_SYNTHETIC) // + .or(org.springframework.data.util.Predicates.IS_NATIVE) // + .or(org.springframework.data.util.Predicates.IS_PRIVATE) // + .or(org.springframework.data.util.Predicates.IS_PROTECTED) // + .or(org.springframework.data.util.Predicates.IS_OBJECT_MEMBER) // + .or(org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER) // + .or(org.springframework.data.util.Predicates.IS_ENUM_MEMBER) // .or(excludedDomainsPredicate.negate()); // return excludedMethodsPredicate.negate(); @@ -196,8 +195,8 @@ public class TypeCollector { @SuppressWarnings("rawtypes") private Predicate createFieldFilter() { - Predicate excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER // - .or(Predicates.IS_SYNTHETIC) // + Predicate excludedFieldPredicate = org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER // + .or(org.springframework.data.util.Predicates.IS_SYNTHETIC) // .or(Predicates.IS_JAVA); return (Predicate) excludedFieldPredicate.negate(); diff --git a/src/main/java/org/springframework/data/aot/TypeContributor.java b/src/main/java/org/springframework/data/util/TypeContributor.java similarity index 98% rename from src/main/java/org/springframework/data/aot/TypeContributor.java rename to src/main/java/org/springframework/data/util/TypeContributor.java index 7641642fc..1b968698b 100644 --- a/src/main/java/org/springframework/data/aot/TypeContributor.java +++ b/src/main/java/org/springframework/data/util/TypeContributor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.aot; +package org.springframework.data.util; import java.lang.annotation.Annotation; import java.util.Collections; diff --git a/src/main/java/org/springframework/data/aot/TypeUtils.java b/src/main/java/org/springframework/data/util/TypeUtils.java similarity index 99% rename from src/main/java/org/springframework/data/aot/TypeUtils.java rename to src/main/java/org/springframework/data/util/TypeUtils.java index b99a84bea..041650644 100644 --- a/src/main/java/org/springframework/data/aot/TypeUtils.java +++ b/src/main/java/org/springframework/data/util/TypeUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.data.aot; +package org.springframework.data.util; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; diff --git a/src/main/resources/META-INF/spring/aot.factories b/src/main/resources/META-INF/spring/aot.factories index bd2257e5e..f25bf746b 100644 --- a/src/main/resources/META-INF/spring/aot.factories +++ b/src/main/resources/META-INF/spring/aot.factories @@ -2,7 +2,8 @@ org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\ org.springframework.data.aot.ManagedTypesBeanFactoryInitializationAotProcessor org.springframework.aot.hint.RuntimeHintsRegistrar=\ - org.springframework.data.repository.aot.hint.RepositoryRuntimeHints + org.springframework.data.repository.aot.hint.RepositoryRuntimeHints,\ + org.springframework.data.querydsl.aot.QuerydslHints org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\ org.springframework.data.aot.AuditingBeanRegistrationAotProcessor diff --git a/src/test/java/org/springframework/data/aot/TypeCollectorUnitTests.java b/src/test/java/org/springframework/data/aot/TypeCollectorUnitTests.java index 639171525..5a8b6b062 100644 --- a/src/test/java/org/springframework/data/aot/TypeCollectorUnitTests.java +++ b/src/test/java/org/springframework/data/aot/TypeCollectorUnitTests.java @@ -19,6 +19,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; import org.springframework.data.aot.types.*; +import org.springframework.data.util.TypeCollector; /** * @author Christoph Strobl diff --git a/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContributionAssert.java b/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContributionAssert.java index 26d70b0ce..55554c441 100644 --- a/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContributionAssert.java +++ b/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotContributionAssert.java @@ -27,6 +27,7 @@ import org.springframework.aot.generate.GenerationContext; import org.springframework.aot.test.generate.TestGenerationContext; import org.springframework.beans.factory.aot.BeanRegistrationCode; import org.springframework.data.aot.CodeContributionAssert; +import org.springframework.data.repository.config.RepositoryRegistrationAotContribution; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.support.RepositoryFragment; diff --git a/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessorIntegrationTests.java b/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessorIntegrationTests.java index 238fc026e..89464c71b 100644 --- a/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessorIntegrationTests.java +++ b/src/test/java/org/springframework/data/repository/aot/RepositoryRegistrationAotProcessorIntegrationTests.java @@ -41,6 +41,8 @@ import org.springframework.data.aot.sample.ReactiveConfig; import org.springframework.data.domain.Page; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.Repository; +import org.springframework.data.repository.config.RepositoryRegistrationAotContribution; +import org.springframework.data.repository.config.RepositoryRegistrationAotProcessor; import org.springframework.data.repository.reactive.ReactiveSortingRepository; import org.springframework.transaction.interceptor.TransactionalProxy;