I\'m trying to use MappingJacksonJsonView with Spring 3.0, without success. I don\'t know what I\'m doing wrong, I think the problem is that I don\'t know how t
Spring will use Accept header sent by the client to return most appropriate view. Here you will find my complete Spring MVC application that returns both JSON and XML.
As you can see, I only needed:
I also used the same annotations: @RequestMapping to map request to a method and @ResponseBody to tell Spring that what I am returning from the controller is the actual response. It might however need some tweaking/formatting, and here Spring takes care of marshalling your object into most appropriate type like JSON.