博主首页

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

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

 

posted @ 2023-05-23 17:41  笑~笑  阅读(52)  评论(0编辑  收藏  举报