【发布时间】:2019-02-10 04:31:05
【问题描述】:
我们已将 springboot 1.5.3 升级到 2.0。在阅读现有文档时,我们遇到了异常。
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.time.Instant]
下面的mongo文档和实体类是一样的。与以前的springboot版本它工作正常。现在我在mongoTemplate.findOne() API 调用期间遇到异常。
{
"_id": "a884b47533a2f2596",
"_class": "com.A.B.C.model.Entity1",
"field1": "00006353",
"field2": "384493",
"field3": "327274",
"date": "2018-09-03T08:25:22.461Z"
}
public class Entity1 {
@Id
private String id;
@Indexed
private String field1;
@Indexed
private String field2;
@Indexed
private String field3;
private Instant date;
}
【问题讨论】:
标签: spring-boot spring-data-mongodb mongotemplate