ResponseBody和文件上传

时间:2019-10-23 19:05:58   收藏:0   阅读:230

SpringMVC默认使用MappingJacksonHttpMessageConverter对json数据进行转换

<dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.9.0</version>
    </dependency>

 

使用@ResponseBody注解实现将Controller方法返回对象转换json响应给客户端。

 

文件上传

第一种方式:使用commons-fileupload组件实现文件上传,需要用到commons-fileupload和commons-io

第二种方式:

原文:https://www.cnblogs.com/taiguyiba/p/11727732.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!