全局处理long类型精度丢失返回前端问题,fastjson

笑~笑 / 2023-05-23 / 原文

    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        Map<Class<?>, JsonSerializer<?>> map = new HashMap<>();
        map.put(Long.class, ToStringSerializer.instance);
        return builder -> builder.serializersByType(map);
    }