美文网首页
springboot 之 springmvc HttpMessa

springboot 之 springmvc HttpMessa

作者: 等一夏_81f7 | 来源:发表于2018-11-09 11:17 被阅读0次

    首先请先理解下面这一段话:

    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

    上面是说 springmvc提供了HttpMessageConverter 接口,用户可以实现接口来转换http请求和响应,比如我们实现请求的序列化和响应的反序列化,

    如果想要自己实现接口,还必须将实现类加入converts中

    下面是实现json序列化和反序列化例子

    相关文章

      网友评论

          本文标题:springboot 之 springmvc HttpMessa

          本文链接:https://www.haomeiwen.com/subject/arinxqtx.html