21
21
import org .springframework .aot .hint .RuntimeHints ;
22
22
import org .springframework .aot .hint .RuntimeHintsRegistrar ;
23
23
import org .springframework .aot .hint .TypeReference ;
24
- import org .springframework .beans .factory .aspectj .AnnotationBeanConfigurerAspect ;
25
24
import org .springframework .data .jpa .domain .support .AuditingBeanFactoryPostProcessor ;
26
25
import org .springframework .data .jpa .domain .support .AuditingEntityListener ;
27
26
import org .springframework .data .jpa .repository .support .SimpleJpaRepository ;
28
27
import org .springframework .lang .Nullable ;
28
+ import org .springframework .util .ClassUtils ;
29
29
30
30
/**
31
31
* @author Christoph Strobl
@@ -36,14 +36,24 @@ public class DataJpaRuntimeHints implements RuntimeHintsRegistrar {
36
36
@ Override
37
37
public void registerHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
38
38
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 , //
41
42
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 )),
45
54
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 ),
47
57
hint -> hint .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_PUBLIC_METHODS ));
48
58
}
49
59
}
0 commit comments