|
|
|
|
@ -15,9 +15,12 @@
@@ -15,9 +15,12 @@
|
|
|
|
|
*/ |
|
|
|
|
package org.springframework.data.mongodb.util; |
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
|
|
|
|
|
import org.springframework.data.util.Version; |
|
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
import org.springframework.util.ReflectionUtils; |
|
|
|
|
|
|
|
|
|
import com.mongodb.internal.build.MongoDriverVersion; |
|
|
|
|
|
|
|
|
|
@ -96,8 +99,9 @@ public class MongoClientVersion {
@@ -96,8 +99,9 @@ public class MongoClientVersion {
|
|
|
|
|
|
|
|
|
|
if (ClassUtils.isPresent("com.mongodb.internal.build.MongoDriverVersion", classLoader)) { |
|
|
|
|
try { |
|
|
|
|
return Version.parse(MongoDriverVersion.VERSION); |
|
|
|
|
} catch (IllegalArgumentException exception) { |
|
|
|
|
Field field = ReflectionUtils.findField(MongoDriverVersion.class, "VERSION"); |
|
|
|
|
return field != null ? Version.parse("" + field.get(null)) : null; |
|
|
|
|
} catch (ReflectiveOperationException | IllegalArgumentException exception) { |
|
|
|
|
// well not much we can do, right?
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|