【7.2.5】更新jackson注解内省

pull/84/head
fengshuonan 2022-09-15 23:36:12 +08:00
parent 94157a6918
commit bac9f82ab1
1 changed files with 5 additions and 1 deletions

View File

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