SpringBoot默认内置的是jackson。
如果想SpringBoot默认使用FastJson,一般有两种方式:
方式一、启动类继承 WebMvcConfigurationSupport 或实现WebMvcConfigurer ,复写configureMessageConverters方法

方式二、添加Bean到Spring容器,进行管理

本文介绍如何让SpringBoot默认使用FastJson替代Jackson。主要通过两种方法实现:一是继承WebMvcConfigurationSupport或实现WebMvcConfigurer并复写configureMessageConverters方法;二是将FastJson的相关Bean添加到Spring容器中进行管理。
SpringBoot默认内置的是jackson。
如果想SpringBoot默认使用FastJson,一般有两种方式:
方式一、启动类继承 WebMvcConfigurationSupport 或实现WebMvcConfigurer ,复写configureMessageConverters方法

方式二、添加Bean到Spring容器,进行管理

1228
1461

被折叠的 条评论
为什么被折叠?