diff --git a/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java b/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java index bb7d4c6a5..ca210b4c9 100644 --- a/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java +++ b/src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java @@ -22,6 +22,7 @@ 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.QuerydslUtils; import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor; import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; @@ -29,15 +30,18 @@ import org.springframework.util.ClassUtils; import com.querydsl.core.types.Predicate; /** + * {@link RuntimeHintsRegistrar} holding required hints to bootstrap Querydsl repositories.
+ * Already registered via {@literal aot.factories}. + * * @author Christoph Strobl - * @since 4.0 + * @since 3.0 */ -public class QuerydslHints implements RuntimeHintsRegistrar { +class QuerydslHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { - if (ClassUtils.isPresent("com.querydsl.core.types.Predicate", classLoader)) { + if (QuerydslUtils.QUERY_DSL_PRESENT) { // repository infrastructure hints.reflection().registerTypes(Arrays.asList( // @@ -47,6 +51,7 @@ public class QuerydslHints implements RuntimeHintsRegistrar { }); if (ClassUtils.isPresent("reactor.core.publisher.Flux", classLoader)) { + // repository infrastructure hints.reflection().registerTypes(Arrays.asList( // TypeReference.of(ReactiveQuerydslPredicateExecutor.class)), builder -> { diff --git a/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java b/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java index 602edbb5f..e9ba3ad70 100644 --- a/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java +++ b/src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java @@ -13,38 +13,6 @@ * 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. - * - * 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.repository.config; import java.lang.reflect.Method; diff --git a/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java b/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java index 1ffbc7a5c..f9769fd09 100644 --- a/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java +++ b/src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java @@ -13,38 +13,6 @@ * 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. - * - * 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.repository.config; import java.lang.annotation.Annotation; @@ -55,11 +23,10 @@ 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.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; +import org.springframework.data.util.TypeCollector; +import org.springframework.data.util.TypeUtils; /** * Default implementation of {@link AotRepositoryContext} diff --git a/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java b/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java index 5ba767e86..89d52970e 100644 --- a/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java @@ -13,38 +13,6 @@ * 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. - * - * 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.repository.config; import java.util.ArrayList; diff --git a/src/main/java/org/springframework/data/util/TypeCollector.java b/src/main/java/org/springframework/data/util/TypeCollector.java index a121d8521..4d18f61fa 100644 --- a/src/main/java/org/springframework/data/util/TypeCollector.java +++ b/src/main/java/org/springframework/data/util/TypeCollector.java @@ -35,7 +35,6 @@ import java.util.function.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.springframework.core.ResolvableType; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; @@ -178,15 +177,15 @@ public class TypeCollector { Predicate excludedDomainsPredicate = methodToTest -> excludedDomainsFilter .test(methodToTest.getDeclaringClass()); - 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) // + 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(); @@ -195,8 +194,8 @@ public class TypeCollector { @SuppressWarnings("rawtypes") private Predicate createFieldFilter() { - Predicate excludedFieldPredicate = org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER // - .or(org.springframework.data.util.Predicates.IS_SYNTHETIC) // + Predicate excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER // + .or(Predicates.IS_SYNTHETIC) // .or(Predicates.IS_JAVA); return (Predicate) excludedFieldPredicate.negate();