记一个springboot与mongodb版本的问题
springboot:2.3.2.RELEASE项目依赖mongodb:3.8.2,报错入下:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.autoconfigure.mongo.MongoClientFactorySupport.applyUuidRepresentation(MongoClientFactorySupport.java:85)
The following method did not exist:
com.mongodb.MongoClientSettings$Builder.uuidRepresentation(Lorg/bson/UuidRepresentation;)Lcom/mongodb/MongoClientSettings$Builder;
The method's class, com.mongodb.MongoClientSettings$Builder, is available from the following locations:
jar:file:/D:/work/repo/org/mongodb/mongo-java-driver/3.8.2/mongo-java-driver-3.8.2.jar!/com/mongodb/MongoClientSettings$Builder.class
The class hierarchy was loaded from the following locations:
com.mongodb.MongoClientSettings.Builder: file:/D:/work/repo/org/mongodb/mongo-java-driver/3.8.2/mongo-java-driver-3.8.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.mongodb.MongoClientSettings$Builder
原因是spirngboot版本与mongodb版本不匹配
springboot版本与mongo版本
一个简单的表格是这么创建的:
springboot 版本 | mongo版本 |
---|---|
2.3.x | mongodb:3.8.2 |