Mongodb org.springframework.core.convert.ConverterNotFoundException: No converter found capable

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.bson.Document] to type [java.lang.String]
    at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1402) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1355) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readProperties(MappingMongoConverter.java:336) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:292) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:245) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:194) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:190) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:78) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.MongoTemplate$ReadDocumentCallback.doWith(MongoTemplate.java:2800) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2416) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:2208) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:717) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]
    at org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:705) ~[spring-data-mongodb-2.0.10.RELEASE.jar:2.0.10.RELEASE]

 

出现上面的错误是因为设置DefaultMongoTypeMapper为null,不能映射

Mongodb org.springframework.core.convert.ConverterNotFoundException: No converter found capable_第1张图片

将上面注释掉就好了

你可能感兴趣的:(mongodb)