com.heimeiqiu.config.CommonConfig 消息转化器
package com.heimeiqiu.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.StringHttpMessageConverter; import java.nio.charset.Charset; /** * Created by wxl on 2017/12/14. * 公共配置类 */ @Configuration //开启配置 public class CommonConfig { /** * 消息转化器 默认 UTF-8 * @return */ @Bean public StringHttpMessageConverter stringHttpMessageConverter() { StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8")); return converter; } }