解决Spring Boot @Responsebody低版本ie返回json时提示下载问题

阅读更多
Spring boot V1.5.6

@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
/**
* 解决低版本ieresponsebody返回json的时候提示下载问题
* @return
*/
public MappingJackson2HttpMessageConverter customJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
List supportedMediaTypes = new ArrayList();
MediaType media = new MediaType(MediaType.TEXT_HTML, Charset.forName("UTF-8"));
supportedMediaTypes.add(media);
jsonConverter.setSupportedMediaTypes(supportedMediaTypes);
return jsonConverter;
}
@Override
public void configureMessageConverters(List> converters) {
converters.add(customJackson2HttpMessageConverter());
}


}

你可能感兴趣的:(spring,ie,json)