19
19
20
20
import java .util .Arrays ;
21
21
22
- import com .mongodb .MongoClientSettings ;
23
- import com .mongodb .ServerAddress ;
24
- import com .mongodb .UnixServerAddress ;
25
- import com .mongodb .client .MapReduceIterable ;
26
- import com .mongodb .client .MongoDatabase ;
27
- import com .mongodb .client .model .IndexOptions ;
28
- import com .mongodb .reactivestreams .client .MapReducePublisher ;
29
22
import org .springframework .aot .hint .MemberCategory ;
30
23
import org .springframework .aot .hint .RuntimeHints ;
31
24
import org .springframework .aot .hint .RuntimeHintsRegistrar ;
38
31
import org .springframework .data .mongodb .core .mapping .event .ReactiveAfterSaveCallback ;
39
32
import org .springframework .data .mongodb .core .mapping .event .ReactiveBeforeConvertCallback ;
40
33
import org .springframework .data .mongodb .core .mapping .event .ReactiveBeforeSaveCallback ;
41
- import org .springframework .data .mongodb .util .MongoClientVersion ;
42
34
import org .springframework .lang .Nullable ;
43
35
import org .springframework .util .ClassUtils ;
44
36
37
+ import com .mongodb .MongoClientSettings ;
38
+ import com .mongodb .ServerAddress ;
39
+ import com .mongodb .UnixServerAddress ;
40
+ import com .mongodb .client .MapReduceIterable ;
41
+ import com .mongodb .client .MongoDatabase ;
42
+ import com .mongodb .client .model .IndexOptions ;
43
+ import com .mongodb .reactivestreams .client .MapReducePublisher ;
44
+
45
45
/**
46
46
* {@link RuntimeHintsRegistrar} for repository types and entity callbacks.
47
47
*
@@ -72,7 +72,6 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
72
72
builder -> builder .withMembers (MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ,
73
73
MemberCategory .INVOKE_PUBLIC_METHODS ));
74
74
}
75
-
76
75
}
77
76
78
77
private static void registerTransactionProxyHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
@@ -89,32 +88,41 @@ private static void registerTransactionProxyHints(RuntimeHints hints, @Nullable
89
88
}
90
89
}
91
90
91
+ @ SuppressWarnings ("deprecation" )
92
92
private static void registerMongoCompatibilityAdapterHints (RuntimeHints hints , @ Nullable ClassLoader classLoader ) {
93
93
94
94
hints .reflection () //
95
95
.registerType (MongoClientSettings .class , MemberCategory .INVOKE_PUBLIC_METHODS )
96
96
.registerType (MongoClientSettings .Builder .class , MemberCategory .INVOKE_PUBLIC_METHODS )
97
97
.registerType (IndexOptions .class , MemberCategory .INVOKE_PUBLIC_METHODS )
98
98
.registerType (ServerAddress .class , MemberCategory .INVOKE_PUBLIC_METHODS )
99
- .registerType (UnixServerAddress .class , MemberCategory .INVOKE_PUBLIC_METHODS )
100
- .registerType (TypeReference .of ("com.mongodb.connection.StreamFactoryFactory" ), MemberCategory .INTROSPECT_PUBLIC_METHODS );
99
+ .registerType (UnixServerAddress .class , MemberCategory .INVOKE_PUBLIC_METHODS ) //
100
+ .registerType (TypeReference .of ("com.mongodb.connection.StreamFactoryFactory" ),
101
+ MemberCategory .INTROSPECT_PUBLIC_METHODS )
102
+ .registerType (TypeReference .of ("com.mongodb.internal.connection.StreamFactoryFactory" ),
103
+ MemberCategory .INTROSPECT_PUBLIC_METHODS )
104
+ .registerType (TypeReference .of ("com.mongodb.internal.build.MongoDriverVersion" ), MemberCategory .PUBLIC_FIELDS );
101
105
102
- if (MongoAotPredicates .isSyncClientPresent (classLoader )) {
106
+ if (MongoAotPredicates .isSyncClientPresent (classLoader )) {
103
107
104
108
hints .reflection () //
105
109
.registerType (MongoDatabase .class , MemberCategory .INVOKE_PUBLIC_METHODS )
106
- .registerType (TypeReference .of ("com.mongodb.client.internal.MongoDatabaseImpl" ), MemberCategory .INVOKE_PUBLIC_METHODS )
110
+ .registerType (TypeReference .of ("com.mongodb.client.internal.MongoDatabaseImpl" ),
111
+ MemberCategory .INVOKE_PUBLIC_METHODS )
107
112
.registerType (MapReduceIterable .class , MemberCategory .INVOKE_PUBLIC_METHODS )
108
- .registerType (TypeReference .of ("com.mongodb.client.internal.MapReduceIterableImpl" ), MemberCategory .INVOKE_PUBLIC_METHODS );
113
+ .registerType (TypeReference .of ("com.mongodb.client.internal.MapReduceIterableImpl" ),
114
+ MemberCategory .INVOKE_PUBLIC_METHODS );
109
115
}
110
116
111
- if (MongoAotPredicates .isReactiveClientPresent (classLoader )) {
117
+ if (MongoAotPredicates .isReactiveClientPresent (classLoader )) {
112
118
113
119
hints .reflection () //
114
120
.registerType (com .mongodb .reactivestreams .client .MongoDatabase .class , MemberCategory .INVOKE_PUBLIC_METHODS )
115
- .registerType (TypeReference .of ("com.mongodb.reactivestreams.client.internal.MongoDatabaseImpl" ), MemberCategory .INVOKE_PUBLIC_METHODS )
121
+ .registerType (TypeReference .of ("com.mongodb.reactivestreams.client.internal.MongoDatabaseImpl" ),
122
+ MemberCategory .INVOKE_PUBLIC_METHODS )
116
123
.registerType (MapReducePublisher .class , MemberCategory .INVOKE_PUBLIC_METHODS )
117
- .registerType (TypeReference .of ("com.mongodb.reactivestreams.client.internal.MapReducePublisherImpl" ), MemberCategory .INVOKE_PUBLIC_METHODS );
124
+ .registerType (TypeReference .of ("com.mongodb.reactivestreams.client.internal.MapReducePublisherImpl" ),
125
+ MemberCategory .INVOKE_PUBLIC_METHODS );
118
126
}
119
127
}
120
128
0 commit comments