I just tried adding this to my sample controller:
@RequestMapping(value="/jsontest", method=RequestMethod.GET)
public @ResponseBody User getUserAsJson() {
User jsonUser = new User();
jsonUser.setFirstName("Mickey");
jsonUser.setLastName("Mouse");
jsonUser.setUsername("mmous");
return jsonUser;
}
However, visiting the /jsontest url ends on a 406 http error => not acceptable.
So... what's the currently working method for producing "application/json" responses, instead of returning jsp/html views?
I'm using Spring Framework 3.0.6 RELEASE.