File tree 1 file changed +8
-1
lines changed
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 27
27
*
28
28
* @author Christoph Strobl
29
29
* @author Mark Paluch
30
+ * @author Vladimir Vishnevskii
30
31
* @since 1.7
31
32
*/
32
33
public class MongoClientVersion {
@@ -96,14 +97,20 @@ private static Version getVersionFromPackage(ClassLoader classLoader) {
96
97
97
98
if (ClassUtils .isPresent ("com.mongodb.internal.build.MongoDriverVersion" , classLoader )) {
98
99
try {
99
- return Version .parse (MongoDriverVersion . VERSION );
100
+ return Version .parse (loadVersionFromMongoDriverVersion () );
100
101
} catch (IllegalArgumentException exception ) {
101
102
// well not much we can do, right?
102
103
}
103
104
}
104
105
return null ;
105
106
}
106
107
108
+ @ Nullable
109
+ private static String loadVersionFromMongoDriverVersion () {
110
+ Field versionField = ReflectionUtils .findField (MongoDriverVersion .class , "VERSION" );
111
+ return (String ) ReflectionUtils .getField (versionField , null );
112
+ }
113
+
107
114
private static Version guessDriverVersionFromClassPath (ClassLoader classLoader ) {
108
115
109
116
if (ClassUtils .isPresent ("com.mongodb.internal.connection.StreamFactoryFactory" , classLoader )) {
You can’t perform that action at this time.
0 commit comments