My Response object like below:
public class ValidationResponse {
@XmlElement(name = "success")
private boolean success = true;
@XmlElement(name = "message")
private Object message;
}
Users class:
public class Users {
@XmlElement(name = "user")
@JsonProperty("users")
private List<User> userList;
}
When I try to produce "application/xml", I got exception as below: com.sun.istack.internal.SAXException2: class com.abcd.dao.domain.user.Users nor any of its super class is known to this context. javax.xml.bind.JAXBException: class com.abcd.dao.domain.user.Users nor any of its super class is known to this context.
How to handle the "Object" type in the response class in spring mvc: ? Please help me to fix this.
By adding @XmlSeeAlso its working as expected:
@XmlSeeAlso({Users.class, User.class})
public class ValidationResponse {
}
Thanks