Why is Spring Data MongoDB unable to instantiate this nested type structure?

前端 未结 2 714
予麋鹿
予麋鹿 2021-02-07 17:50

My document structure is like:

{
    _id: \"A\",
    groups:[{
        groupId: \"someId\",
        groupName: \"someName\",
        params: {
            type1:         


        
2条回答
  •  有刺的猬
    2021-02-07 18:02

    Failed to instantiate ... using constructor public ... ReflectionEntityInstantiator
    

    says it cannot create the objects using reflection.

    Do you have getters and setters for all the fields in all your classes? Your code above does not have them for ParamData, Config and DataConfig.

    Also, if you happen to have non-default constructors in any of your classes make sure you have an empty argument constructor, else reflection will fail.

提交回复
热议问题