标签:sem media pen class boot 解决 arrays htm edm
pom 文件引用
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.34</version> </dependency>
bean注入(配置在 SpringBootApplication 的启动类中) ps:已解决中文乱码问题
@Bean public HttpMessageConverters fastJsonHttpMessageConverters() { FastJsonHttpMessageConverter4 fastConverter = new FastJsonHttpMessageConverter4(); FastJsonConfig fastJsonConfig = new FastJsonConfig(); fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue); fastConverter.setFastJsonConfig(fastJsonConfig); fastConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8, MediaType.parseMediaType("text/html;charset=UTF-8"))); return new HttpMessageConverters(fastConverter); }
标签:sem media pen class boot 解决 arrays htm edm
原文地址:http://www.cnblogs.com/rufus-hua/p/7190241.html