@Configuration public class SessionConfig implements WebMvcConfigurer{ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { FastJsonHttpMessageConverter fastJsonConverter = new FastJsonHttpMessageConverter(); FastJsonConfig fjc = new FastJsonConfig(); SerializeConfig serializeConfig = SerializeConfig.globalInstance; serializeConfig.put(Long.class , ToStringSerializer.instance); serializeConfig.put(Long.TYPE , ToStringSerializer.instance); fjc.setSerializeConfig(serializeConfig); fastJsonConverter.setFastJsonConfig(fjc); converters.add(fastJsonConverter); } }