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()); + }; } /**