views:

12

answers:

0

So I have a class with some objects as parameters, for example:

public class Person {
 private String firstname;
 private String lastname;
 private School school;

 public Person(){
  super();
 }
}

public class School{
 private String name;
 private String location;
 private Date founded;

 public School(){
  super();
 }

 public School(String name){
  this.name = name;
  super();
 }
}

I want to be able to unmarshal xml like this

<person>
 <firstname>Firstname</firstname>
 <lastname>Lastname</lastname>
 <school>University of Chicago</school>
</person>

I want the result to be a person object with a firstname, lastname, and school object and I want the school object to have the name property populated. When I use the MappingJacksonHttpMessageConverter to unmarshal json, it works fine. The JavaBeanConverter does not seem to work, it doesn't call a matching constructor. Any ideas on how I can get this to work?