![](/img/trans.png)
[英]“Failed to instantiate java.util.List using constructor NO_CONSTRUCTOR with arguments ”,
[英]Failed to instantiate java.util.List using constructor NO_CONSTRUCTOR with arguments ]
我正进入(状态
Failed to instantiate java.util.List using constructor NO_CONSTRUCTOR with arguments ] with root cause
org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.List]: Specified class is an interface
更新mongodb嵌套文档时出现此异常。
问题是这个链接的dicscuseed相同
但仍然不知道如何解决它。 有谁去过这个?
我只是遇到了同样的问题并解决了它,这要归功于: Mongo db java unwind操作在聚合查询中抛出异常
在聚合中放松发生时,结果变平了,所以在我的情况下,我有一个类如下:
MyClass {
String _id;
List<SomeObject> objectList;
}
出现异常是因为展平,我的列表对象上的结果而不是数组中的结果,现在因为$ unwind而只是一个对象。
我为解决这个问题所做的是创建没有列表的同一个类:
MyClassAggregationResult {
String _id;
SomeObject objectList;
}
这样就可以正确映射结果。
希望这也适合你。
改为如下,它应该工作
String _id;
SomeObject objectList;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.