From a2726545c1f0d779fd88e84c9a83554bd264d635 Mon Sep 17 00:00:00 2001
From: chenlang <channlang@163.com>
Date: Wed, 21 Apr 2021 13:54:39 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E8=BD=AC=E6=8D=A2=E5=99=A8=20=E8=A7=A3=E5=86=B3?=
 =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E6=8E=A5=E6=94=B6=E5=89=8D=E7=AB=AF?=
 =?UTF-8?q?=E4=BC=A0=E8=BF=87=E6=9D=A5=E7=9A=84jsonArray=E2=80=94=E2=80=94?=
 =?UTF-8?q?key=E6=97=A0=E5=8F=8C=E5=BC=95=E5=8F=B7=E5=8F=8D=E5=BA=8F?=
 =?UTF-8?q?=E5=88=97=E5=8C=96List=EF=BC=88=E5=AF=B9=E8=B1=A1=EF=BC=89?=
 =?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../framework/config/ConfigurerConfig.java    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/ConfigurerConfig.java

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ConfigurerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ConfigurerConfig.java
new file mode 100644
index 000000000..33a0ca74c
--- /dev/null
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ConfigurerConfig.java
@@ -0,0 +1,58 @@
+/*
+ *  Copyright 2019-2020 Zheng Jie
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package com.ruoyi.framework.config;
+
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @Description: 配置web
+* @Author: Chenlang
+* @Date: 2021/4/20 13:32
+*/
+@Configuration
+@EnableWebMvc
+public class ConfigurerConfig implements WebMvcConfigurer {
+
+    /**
+    * @Description: 配置消息转换器 fastJson
+    * @Author: Chenlang
+    * @Date: 2021/4/21 13:54
+    */
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
+        List<MediaType> supportMediaTypeList = new ArrayList<>();
+        supportMediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
+        FastJsonConfig config = new FastJsonConfig();
+        config.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
+        converter.setFastJsonConfig(config);
+        converter.setSupportedMediaTypes(supportMediaTypeList);
+        converter.setDefaultCharset(StandardCharsets.UTF_8);
+        converters.add(converter);
+    }
+}