Spring 3 JSON with MVC

前端 未结 8 953
温柔的废话
温柔的废话 2020-12-23 02:33

Is there a way to build Spring Web calls that consume and produce application/json formatted requests and responses respectively?

Maybe this i

8条回答
  •  时光取名叫无心
    2020-12-23 02:43

    This feature is now part of Spring since version 3.0. You can simply use the @ResponseBody annotation to specify that you want the return value from your request handler methods to be serialized to JSON and sent as the response body. See http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/

提交回复
热议问题