lihengming 6 years ago
parent ef7e6e4817
commit c305af6a6b
  1. 3
      src/main/java/com/company/project/configurer/WebMvcConfigurer.java

@ -3,6 +3,7 @@ package com.company.project.configurer;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -24,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.HandlerExceptionResolver;
@ -56,6 +58,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
converter.setFastJsonConfig(config); converter.setFastJsonConfig(config);
converter.setDefaultCharset(Charset.forName("UTF-8")); converter.setDefaultCharset(Charset.forName("UTF-8"));
converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8));
converters.add(converter); converters.add(converter);
} }

Loading…
Cancel
Save