|
1
|
-//package com.zhonglai.luhui.smart.feeder.config;
|
|
|
|
2
|
-//
|
|
|
|
3
|
-//
|
|
|
|
4
|
-//import com.google.gson.Gson;
|
|
|
|
5
|
-//import com.ruoyi.common.utils.GsonConstructor;
|
|
|
|
6
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
7
|
-//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
|
|
8
|
-//import org.springframework.context.annotation.Configuration;
|
|
|
|
9
|
-//import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
10
|
-//import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
|
|
|
11
|
-//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
12
|
-//
|
|
|
|
13
|
-//import java.util.ArrayList;
|
|
|
|
14
|
-//import java.util.List;
|
|
|
|
15
|
-//
|
|
|
|
16
|
-//
|
|
|
|
17
|
-//@Configuration
|
|
|
|
18
|
-//public class HttpMessageConverterConfig {
|
|
|
|
19
|
-// @Autowired
|
|
|
|
20
|
-// public void configureHttpMessageConverters(HttpMessageConverters converters, Gson gson) {
|
|
|
|
21
|
-// List<HttpMessageConverter<?>> converterList = new ArrayList<>(converters.getConverters());
|
|
|
|
22
|
-// for (HttpMessageConverter<?> converter : converterList) {
|
|
|
|
23
|
-// if (converter instanceof MappingJackson2HttpMessageConverter) {
|
|
|
|
24
|
-// converterList.remove(converter);
|
|
|
|
25
|
-// break;
|
|
|
|
26
|
-// }
|
|
|
|
27
|
-// }
|
|
|
|
28
|
-// converterList.add(new GsonHttpMessageConverter(gson));
|
|
|
|
29
|
-// }
|
|
|
|
30
|
-//
|
|
|
|
31
|
-//} |
1
|
+package com.zhonglai.luhui.smart.feeder.config;
|
|
|
|
2
|
+
|
|
|
|
3
|
+
|
|
|
|
4
|
+import com.google.gson.Gson;
|
|
|
|
5
|
+import com.ruoyi.common.utils.GsonConstructor;
|
|
|
|
6
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
7
|
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
|
|
8
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
9
|
+import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
10
|
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
|
|
|
11
|
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
12
|
+
|
|
|
|
13
|
+import java.util.ArrayList;
|
|
|
|
14
|
+import java.util.List;
|
|
|
|
15
|
+
|
|
|
|
16
|
+
|
|
|
|
17
|
+@Configuration
|
|
|
|
18
|
+public class HttpMessageConverterConfig {
|
|
|
|
19
|
+ @Autowired
|
|
|
|
20
|
+ public void configureHttpMessageConverters(HttpMessageConverters converters, Gson gson) {
|
|
|
|
21
|
+ List<HttpMessageConverter<?>> converterList = new ArrayList<>(converters.getConverters());
|
|
|
|
22
|
+ for (HttpMessageConverter<?> converter : converterList) {
|
|
|
|
23
|
+ if (converter instanceof MappingJackson2HttpMessageConverter) {
|
|
|
|
24
|
+ converterList.remove(converter);
|
|
|
|
25
|
+ break;
|
|
|
|
26
|
+ }
|
|
|
|
27
|
+ }
|
|
|
|
28
|
+ converterList.add(new GsonHttpMessageConverter(gson));
|
|
|
|
29
|
+ }
|
|
|
|
30
|
+
|
|
|
|
31
|
+} |