Issue
So I have a class which I'm trying to store database, moreover there are mapper built for Spec class to store in database.
data class Spec(
payload: SpecPayload?
type: SpecType
)
abstract class SpecPayload {
...
}
data class LinkPayload(
) : SpecPayload()
data class CodePayload(
): SpecPayload()
But I'm getting this error
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `SpecPayload` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
Any help?
Solution
Answering my own questions, the reason it failed cause I wasn't using @Component
over class.
Answered By - Lakshya
Answer Checked By - Gilberto Lyons (JavaFixing Admin)