赞
踩
注意:本文以序列化枚举转换为例
一、引入fastjson依赖
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.58</version>
- </dependency>
二、配置fastjson替代jackson
- package com.cdn.one.config;
-
- import com.alibaba.fastjson.serializer.SerializerFeature;
- import com.alibaba.fastjson.support.config.FastJsonConfig;
- import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
- import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.http.MediaType;
- import org.springframework.http.converter.HttpMessageConverter;
-
- import java.nio.charset.StandardCharsets;
- import java.util.ArrayList;
- import java.util.List;
-
- /**
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。