标签:设定 sage div for string json序列化 序列 orm span
在@SpringBootApplication类中添加
@Bean public HttpMessageConverters fastJsonHttpMessageConverters() { //创建FastJson信息转换对象 FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter(); //创建FastJson对象并设定序列化规则 FastJsonConfig fastJsonConfig = new FastJsonConfig(); fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat); fastJsonHttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8)); //规则赋予转换对象 fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig); return new HttpMessageConverters(fastJsonHttpMessageConverter, new StringHttpMessageConverter(Charset.forName("UTF-8"))); }
springboot利用fastjson序列化输出(默认是jackson)
标签:设定 sage div for string json序列化 序列 orm span
原文地址:https://www.cnblogs.com/koushr/p/9211808.html