SD MongoDB polymorphism in subdocument

前端 未结 1 1698
梦如初夏
梦如初夏 2021-01-06 12:16

I just started developing some app in Java with spring-data-mongodb and came across some issue that I haven\'t been able to solve:

Have a couple of document beans li

相关标签:
1条回答
  • 2021-01-06 12:57

    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!

    0 讨论(0)
提交回复
热议问题