How to achieve springMVC parameters of the package, and automatically returns Json

HTTP requests and responses are text-based , meaning that the browser and the server communicate by exchanging the original text. However, the use of Spring, method of the controller class to return pure 'String' type and a domain model (built-in Java or other objects). How object serialization / de-serialization of the original text? This is handled by HttpMessageConverter.

 

During post request, encapsulated in requestBody HttpMessageConverter parameters are serialized, vo encapsulated object.

 

During a data return, our HttpMessageConverter types Json format into the target sequence, encapsulated in reponseBody.

 

Note: The above chicken-based dish of understanding, if not, do not spray!

Guess you like

Origin www.cnblogs.com/uzxin/p/11861954.html