首先請(qǐng)先理解下面這一段話(huà):
Spring MVC uses the?HttpMessageConverter?interface to convert HTTP requests and responses. Sensible defaults are included out of the box. For example, objects can be automatically converted to JSON (by using the Jackson library) or XML (by using the Jackson XML extension, if available, or by using JAXB if the Jackson XML extension is not available). By default, strings are encoded in?UTF-8
上面是說(shuō) springmvc提供了HttpMessageConverter 接口,用戶(hù)可以實(shí)現(xiàn)接口來(lái)轉(zhuǎn)換http請(qǐng)求和響應(yīng),比如我們實(shí)現(xiàn)請(qǐng)求的序列化和響應(yīng)的反序列化,
如果想要自己實(shí)現(xiàn)接口,還必須將實(shí)現(xiàn)類(lèi)加入converts中

下面是實(shí)現(xiàn)json序列化和反序列化例子
