I'm setting up a REST route with JAX-RS+Jersey that consumes a JSON object. This JSON object is special because one of the fields it contains is associated with a Morphia entity. Is there a way to integrate Morphia's object-mapping with Jackson so that I can deserialize my object?
Example:
Incoming JSON object in request body:
{
operation: "CREATE",
document: { // This object is a Morphia entity
"name": "Bob"
"age": 18
}
}
should be mapped to
POJO :
public class JSONContainer {
String operation;
Document document; // This object is a Morphia entity
}
查看这个名为“ morphia_jackson_polymorphism_example ”的github项目。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.