From bac9f82ab1076678b155ab93c49379b98ee9b5dc Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Thu, 15 Sep 2022 23:36:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.2.5=E3=80=91=E6=9B=B4=E6=96=B0jackso?= =?UTF-8?q?n=E6=B3=A8=E8=A7=A3=E5=86=85=E7=9C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stylefeng/guns/config/web/SpringMvcConfiguration.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java b/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java index fdaa06c0..ebb3f2c7 100644 --- a/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java +++ b/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java @@ -4,6 +4,7 @@ import cn.stylefeng.guns.core.error.CustomErrorAttributes; import cn.stylefeng.guns.core.security.AuthJwtTokenSecurityInterceptor; import cn.stylefeng.guns.core.security.PermissionSecurityInterceptor; import cn.stylefeng.roses.kernel.security.cors.CorsFilterConfiguration; +import cn.stylefeng.roses.kernel.wrapper.field.jackson.CustomJacksonIntrospector; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; @@ -50,7 +51,10 @@ public class SpringMvcConfiguration implements WebMvcConfigurer { */ @Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { - return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance).serializerByType(Long.TYPE, ToStringSerializer.instance); + return jacksonObjectMapperBuilder -> { + jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance).serializerByType(Long.TYPE, ToStringSerializer.instance); + jacksonObjectMapperBuilder.annotationIntrospector(new CustomJacksonIntrospector()); + }; } /**