You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
982 B
Java
36 lines
982 B
Java
|
|
package com.bsd.say.config;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
import java.nio.charset.Charset;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 配置中文支持
|
|
*
|
|
* @author
|
|
*/
|
|
@Configuration
|
|
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
|
|
|
|
|
@Bean
|
|
public HttpMessageConverter<String> responseBodyConverter() {
|
|
StringHttpMessageConverter converter = new StringHttpMessageConverter(
|
|
Charset.forName("UTF-8"));
|
|
return converter;
|
|
}
|
|
|
|
|
|
@Override
|
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
super.configureMessageConverters(converters);
|
|
converters.add(responseBodyConverter());
|
|
}
|
|
}
|