I would like to be able to reuse the existing Jackson2ObjectMapperBuilder to set an AnnotationIntrospector for serialization only.

This is currently not possible since the Jackson2ObjectMapperBuilder only supports a single AnnotationIntrospector which will be used for both serialization and deserialization.

Comment From: sdeleuze

Does ObjectMapper#setAnnotationIntrospectors supports nullable parameters?

Comment From: otheriault

If null is provided, then the annotation introspector in the underlying BaseSettings will have a null introspector. This would probably lead to NullPointerException at runtime.

It would be better to check that the annotation introspector is not null when set in the Jackson2ObjectMapperBuilder.

Comment From: rstoyanchev

@otheriault I think we can achieve this with #24824 by providing more control for such situations. I'm closing this in favor of that.

Comment From: rstoyanchev

On closer look we'll add a Consumer<ObjectMapper> for this issue while #24824 can be done separately through an explicit property.