|  |  | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  | import org.springframework.http.MediaType; | 
 |  |  | import org.springframework.http.converter.HttpMessageConverter; | 
 |  |  | //import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | 
 |  |  | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | 
 |  |  |  | 
 |  |  | import java.nio.charset.StandardCharsets; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 必须实现WebMvcConfigurer否则不启作用,即Controller转json时不用fastjson | 
 |  |  |  */ | 
 |  |  | @Configuration | 
 |  |  | public class FastJsonConfig  { | 
 |  |  | public class FastJsonConfig implements WebMvcConfigurer { | 
 |  |  |     /** | 
 |  |  |      * 配置fastjson输出格式 | 
 |  |  |      **/ | 
 |  |  |     @SuppressWarnings("unused") | 
 |  |  |     @Override | 
 |  |  |     public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | 
 |  |  |         // 1. 配置fastjson | 
 |  |  |         com.alibaba.fastjson2.support.config.FastJsonConfig config = new com.alibaba.fastjson2.support.config.FastJsonConfig(); |