|
|
|
//package com.zhonglai.luhui.smart.feeder.config;
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//import com.google.gson.Gson;
|
|
|
|
//import com.ruoyi.common.utils.GsonConstructor;
|
|
|
|
//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
|
|
//import org.springframework.context.annotation.Configuration;
|
|
|
|
//import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
//import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
|
|
|
//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
//
|
|
|
|
//import java.util.ArrayList;
|
|
|
|
//import java.util.List;
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//@Configuration
|
|
|
|
//public class HttpMessageConverterConfig {
|
|
|
|
// @Autowired
|
|
|
|
// public void configureHttpMessageConverters(HttpMessageConverters converters, Gson gson) {
|
|
|
|
// List<HttpMessageConverter<?>> converterList = new ArrayList<>(converters.getConverters());
|
|
|
|
// for (HttpMessageConverter<?> converter : converterList) {
|
|
|
|
// if (converter instanceof MappingJackson2HttpMessageConverter) {
|
|
|
|
// converterList.remove(converter);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// converterList.add(new GsonHttpMessageConverter(gson));
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//} |
|
|
|
package com.zhonglai.luhui.smart.feeder.config;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.ruoyi.common.utils.GsonConstructor;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
|
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
public class HttpMessageConverterConfig {
|
|
|
|
@Autowired
|
|
|
|
public void configureHttpMessageConverters(HttpMessageConverters converters, Gson gson) {
|
|
|
|
List<HttpMessageConverter<?>> converterList = new ArrayList<>(converters.getConverters());
|
|
|
|
for (HttpMessageConverter<?> converter : converterList) {
|
|
|
|
if (converter instanceof MappingJackson2HttpMessageConverter) {
|
|
|
|
converterList.remove(converter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
converterList.add(new GsonHttpMessageConverter(gson));
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|