2121import org .springframework .aot .hint .RuntimeHints ;
2222import org .springframework .aot .hint .RuntimeHintsRegistrar ;
2323import org .springframework .aot .hint .TypeReference ;
24- import org .springframework .beans .factory .aspectj .AnnotationBeanConfigurerAspect ;
2524import org .springframework .data .jpa .domain .support .AuditingBeanFactoryPostProcessor ;
2625import org .springframework .data .jpa .domain .support .AuditingEntityListener ;
2726import org .springframework .data .jpa .repository .support .SimpleJpaRepository ;
2827import org .springframework .lang .Nullable ;
28+ import org .springframework .util .ClassUtils ;
2929
3030/**
3131 * @author Christoph Strobl
@@ -36,14 +36,24 @@ public class DataJpaRuntimeHints implements RuntimeHintsRegistrar {
3636 @ Override
3737 public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
3838
39- hints .proxies ().registerJdkProxy (org .springframework .data .jpa .repository .support .CrudMethodMetadata .class ,
40- org .springframework .aop .SpringProxy .class , org .springframework .aop .framework .Advised .class ,
39+ hints .proxies ().registerJdkProxy (org .springframework .data .jpa .repository .support .CrudMethodMetadata .class , //
40+ org .springframework .aop .SpringProxy .class , //
41+ org .springframework .aop .framework .Advised .class , //
4142 org .springframework .core .DecoratingProxy .class );
42- hints .reflection ().registerTypes (
43- Arrays .asList (TypeReference .of (AnnotationBeanConfigurerAspect .class ),
44- TypeReference .of (AuditingBeanFactoryPostProcessor .class ), TypeReference .of (AuditingEntityListener .class )),
43+
44+ if (ClassUtils .isPresent ("org.springframework.beans.factory.aspectj.ConfigurableObject" , classLoader )) {
45+
46+ hints .reflection ().registerType (
47+ TypeReference .of ("org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect" ), hint -> hint
48+ .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_DECLARED_METHODS ));
49+ }
50+
51+ hints .reflection ().registerTypes (Arrays .asList ( //
52+ TypeReference .of (AuditingBeanFactoryPostProcessor .class ), //
53+ TypeReference .of (AuditingEntityListener .class )),
4554 hint -> hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_DECLARED_METHODS ));
46- hints .reflection ().registerTypes (Arrays .asList (TypeReference .of (SimpleJpaRepository .class )),
55+
56+ hints .reflection ().registerType (TypeReference .of (SimpleJpaRepository .class ),
4757 hint -> hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_PUBLIC_METHODS ));
4858 }
4959}
0 commit comments