File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1515 */
1616package org .springframework .data .mongodb .util ;
1717
18+ import java .lang .reflect .Field ;
19+
1820import org .springframework .data .util .Version ;
1921import org .springframework .lang .Nullable ;
2022import org .springframework .util .ClassUtils ;
23+ import org .springframework .util .ReflectionUtils ;
2124
2225import com .mongodb .internal .build .MongoDriverVersion ;
2326
@@ -96,8 +99,9 @@ private static Version getVersionFromPackage(ClassLoader classLoader) {
9699
97100 if (ClassUtils .isPresent ("com.mongodb.internal.build.MongoDriverVersion" , classLoader )) {
98101 try {
99- return Version .parse (MongoDriverVersion .VERSION );
100- } catch (IllegalArgumentException exception ) {
102+ Field field = ReflectionUtils .findField (MongoDriverVersion .class , "VERSION" );
103+ return field != null ? Version .parse ("" + field .get (null )) : null ;
104+ } catch (ReflectiveOperationException | IllegalArgumentException exception ) {
101105 // well not much we can do, right?
102106 }
103107 }
You can’t perform that action at this time.
0 commit comments