소스 검색

Long精度丢失

wangwl 2 주 전
부모
커밋
61fdf20b7f
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      leromro-framework/src/main/java/com/leromro/framework/config/ApplicationConfig.java

+ 5 - 1
leromro-framework/src/main/java/com/leromro/framework/config/ApplicationConfig.java

@@ -1,6 +1,8 @@
 package com.leromro.framework.config;
 
 import java.util.TimeZone;
+
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
 import org.springframework.context.annotation.Bean;
@@ -25,6 +27,8 @@ public class ApplicationConfig
     @Bean
     public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
     {
-        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
+        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault())
+                .serializerByType(Long.class, new ToStringSerializer())
+                .serializerByType(Long.TYPE, new ToStringSerializer());
     }
 }