Spring MappingJacksonJsonView, how to tell to use it instead of JSP view?

后端 未结 4 1749
慢半拍i
慢半拍i 2021-01-03 07:30

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

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 08:12

    you will need to see ContentNegotiatingViewResolver,and set defaultviews property to MappingJacksonJsonView, and @ResponseBody uses HttpMessageConverter to instead of ViewSolver,see the differences between them http://ufasoli.blogspot.com/2013/08/viewresolver-vs-messageconverter-spring.html

提交回复
热议问题