1. 自动封装返回对象为JSON

  1).在spring配置文件中添加如下配置:

    <mvc:annotation-driven>
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.json.GsonHttpMessageConverter"/>
        </mvc:message-converters>
    </mvc:annotation-driven>

  2).在需要进行转化的Controller上添加 @RestController 或method上添加@ResponseBody注解

相关文章:

  • 2021-10-01
  • 2021-08-14
  • 2021-09-29
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-20
  • 2021-09-02
  • 2021-12-27
  • 2021-11-26
相关资源
相似解决方案