Skip to content

Add a way to combine more than one AnnotationIntrospector in Jackson2ObjectMapperBuilder instead of overriding it #22830

@anatoliy-balakirev

Description

@anatoliy-balakirev

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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions