1
https://github.com/alibaba/fastjson/wiki/%E5%9C%A8-Spring-%E4%B8%AD%E9%9B%86%E6%88%90-Fastjson
FastJsonConfig config = new FastJsonConfig(); config.setDateFormat(yy-MM-dd HH:mm:ss)
结果为:"2017-10-27T13:00:22.915"
https://github.com/alibaba/fastjson/wiki/%E5%9C%A8-Spring-%E4%B8%AD%E9%9B%86%E6%88%90-Fastjson
FastJsonConfig config = new FastJsonConfig(); config.setDateFormat(yy-MM-dd HH:mm:ss)
结果为:"2017-10-27T13:00:22.915"
@yizmao 你确定将FastJsonConfig注入到FastJsonHttpMessageConverter?
@Configuration public class HttpMessageConverterConfig {
@Bean
public WebMvcConfigurer configureMessageConverters(){
return new WebMvcConfigurer() {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
FastJsonConfig config = new FastJsonConfig();
config.setDateFormat("yy-MM-dd HH:mm:ss");
converters.add(converter);
}
};
}
} @VictorZeng
@yizmao 朋友,你得converter.setFastJsonConfig(config);
@VictorZeng 谢谢老哥,是我脑子抽了没看到