Adapt to changed AOT packages in Spring Data Commons.

Closes #2661
This commit is contained in:
Mark Paluch
2022-10-11 11:40:05 +02:00
parent 3a3c9372c7
commit c2073d51cf
5 changed files with 17 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jpa.aot;
package org.springframework.data.jpa.repository.aot;
import java.util.Arrays;
@@ -29,10 +29,12 @@ import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
/**
* Runtime hints for JPA AOT processing.
*
* @author Christoph Strobl
* @since 3.0
*/
public class JpaRuntimeHints implements RuntimeHintsRegistrar {
class JpaRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
@@ -49,9 +51,10 @@ public class JpaRuntimeHints implements RuntimeHintsRegistrar {
.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS));
hints.reflection().registerTypes(Arrays.asList( //
TypeReference.of(AuditingBeanFactoryPostProcessor.class), //
TypeReference.of(AuditingEntityListener.class)),
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS));
TypeReference.of(AuditingBeanFactoryPostProcessor.class), //
TypeReference.of(AuditingEntityListener.class)),
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS));
}
hints.reflection().registerType(TypeReference.of(SimpleJpaRepository.class),

View File

@@ -46,13 +46,13 @@ import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.io.ResourceLoader;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.aot.AotRepositoryContext;
import org.springframework.data.aot.RepositoryRegistrationAotProcessor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.support.DefaultJpaContext;
import org.springframework.data.jpa.repository.support.EntityManagerBeanDefinitionRegistrarPostProcessor;
import org.springframework.data.jpa.repository.support.JpaEvaluationContextExtension;
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
import org.springframework.data.repository.aot.AotRepositoryContext;
import org.springframework.data.repository.aot.RepositoryRegistrationAotProcessor;
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport;
import org.springframework.data.repository.config.RepositoryConfigurationSource;

View File

@@ -1,2 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.data.jpa.aot.JpaRuntimeHints
org.springframework.data.jpa.repository.aot.JpaRuntimeHints

View File

@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jpa.aot;
package org.springframework.data.jpa.repository.aot;
import static org.assertj.core.api.AssertionsForClassTypes.*;
import static org.springframework.aot.hint.predicate.RuntimeHintsPredicates.reflection;
import static org.springframework.aot.hint.predicate.RuntimeHintsPredicates.*;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect;
import org.springframework.data.jpa.domain.support.AuditingBeanFactoryPostProcessor;
@@ -26,6 +27,8 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.jpa.util.HidingClassLoader;
/**
* Unit tests for {@link JpaRuntimeHints}.
*
* @author Christoph Strobl
*/
class JpaRuntimeHintsUnitTests {

View File

@@ -31,7 +31,7 @@ import org.springframework.aot.generate.InMemoryGeneratedFiles;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.data.aot.AotRepositoryContext;
import org.springframework.data.repository.aot.AotRepositoryContext;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.javapoet.ClassName;