全局处理long类型精度丢失返回前端问题,fastjson
@Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { Map<Class<?>, JsonSerializer<?>> map = new HashMap<>(); map.put(Long.class, ToStringSerializer.instance); return builder -> builder.serializersByType(map); }