@@ -52,15 +52,7 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
52
52
builder -> builder .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ,
53
53
MemberCategory .INVOKE_PUBLIC_METHODS ));
54
54
55
- if (ClassUtils .isPresent ("org.springframework.aop.SpringProxy" , classLoader )) {
56
-
57
- hints .proxies ().registerJdkProxy (TypeReference .of (com .mongodb .client .MongoDatabase .class ),
58
- TypeReference .of ("org.springframework.aop.SpringProxy" ),
59
- TypeReference .of ("org.springframework.core.DecoratingProxy" ));
60
- hints .proxies ().registerJdkProxy (TypeReference .of (com .mongodb .client .MongoCollection .class ),
61
- TypeReference .of ("org.springframework.aop.SpringProxy" ),
62
- TypeReference .of ("org.springframework.core.DecoratingProxy" ));
63
- }
55
+ registerTransactionProxyHints (hints , classLoader );
64
56
65
57
if (isReactorPresent ()) {
66
58
@@ -73,4 +65,17 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
73
65
74
66
}
75
67
}
68
+
69
+ private static void registerTransactionProxyHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
70
+
71
+ if (MongoAotPredicates .isSyncClientPresent (classLoader ) && ClassUtils .isPresent ("org.springframework.aop.SpringProxy" , classLoader )) {
72
+
73
+ hints .proxies ().registerJdkProxy (TypeReference .of ("com.mongodb.client.MongoDatabase" ),
74
+ TypeReference .of ("org.springframework.aop.SpringProxy" ),
75
+ TypeReference .of ("org.springframework.core.DecoratingProxy" ));
76
+ hints .proxies ().registerJdkProxy (TypeReference .of ("com.mongodb.client.MongoCollection" ),
77
+ TypeReference .of ("org.springframework.aop.SpringProxy" ),
78
+ TypeReference .of ("org.springframework.core.DecoratingProxy" ));
79
+ }
80
+ }
76
81
}
0 commit comments