type
Post
status
Published
date
Apr 7, 2021
slug
summary
tags
Java
category
笔记
icon
password
前端精度16位
后端Long 精度19位
丢失3位
后端返回 1481155970703867906
前端接受 1481155970703867000
解决方案:
Long 改成 String
/** * 解决Jackson导致Long型数据精度丢失问题 * * @return */ @Bean("jackson2ObjectMapperBuilderCustomizer") public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { Jackson2ObjectMapperBuilderCustomizer customizer = jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance) .serializerByType(Long.TYPE, ToStringSerializer.instance); return customizer; }
- Author:Brust
- URL:https://brust.me/article/9fb0a380-8a6c-43f8-9440-1d715e3591a2
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts