Enhancement

Today there is an option to provide custom annotationIntrospector to the Jackson2ObjectMapperBuilder via Jackson2ObjectMapperBuilderCustomizer:

    @Bean
    public Jackson2ObjectMapperBuilderCustomizer myCustomizer() {
        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.annotationIntrospector(new MyIntrospector());
    }

However, in that way I'm replacing existing introspector. So if some other introspectors were added by some libs - they will be just lost and today there seems to be no option to extend existing ones instead.

Would be good to adjust org.springframework.http.converter.json.Jackson2ObjectMapperBuilder to either provide some way to get currently configured annotationIntrospector (so that I can use something like AnnotationIntrospector.pair to combine it with mine) or to have some other way to add new introspector to current one instead of replacing it.

Comment From: philwebb

Thanks for the suggestion. Although Jackson2ObjectMapperBuilderCustomizer is part of Spring Boot I believe it's Jackson2ObjectMapperBuilder that would need to change. Since that's part of Spring Framework, we'll migrate this issue for that team to consider.

Comment From: dazito

Hi, is there any feedback regarding this issue? I see it is waiting for triage :(

Comment From: rstoyanchev

I think we can add an extra annotationIntrospector method that takes Function<AnnotationIntrospector, AnnotationIntrospector> annotationIntrospector, so you can choose to use AnnotationIntrospectorPair and combine with the existing one, if configured.