SD MongoDB polymorphism in subdocument

…衆ロ難τιáo~ 提交于 2019-12-01 00:10:10
Bruno

I had a similar problem, I have a class that implements an interface and when I use findAll I get the error:

org.springframework.data.mapping.model.MappingInstantiationException: Could not instantiate bean class [test.MetaClasse]: Specified class is an interface.

After debugging SpringData code, I realized that Mapper uses @TypeAlias to discover the type it has to instantiate, so I just put @TypeAlias("FullClassName") on my implementations of test.MetaClasse and it worked!

I tested with your situation and it will work!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!