I am using JDK 1.6 and Spring 3.1.3 to create a RESTful service that accepts an object as JSON which gets converted into a Java object by Spring that I have specified in my service method. Now Spring takes care of parsing the JSON into the Java object and everything works fine.
The problem appears when I add a property to my primary object which is a superclass reference and can hold a reference to one of its many subclasses. When the JSON is received, the data for the superclass reference is equivalent to one of the subclasses. I found this link that talks about writing a custom deserializer (Gson and abstract superclasses: deserialization issue) but I dont understand how to configure spring to use this.
Any pointers?