Skip to content

implement issue #6168 configure jackson 3 mapper#6183

Open
bitkid wants to merge 6 commits into
eclipse-vertx:masterfrom
bitkid:sascha/configure-mapper
Open

implement issue #6168 configure jackson 3 mapper#6183
bitkid wants to merge 6 commits into
eclipse-vertx:masterfrom
bitkid:sascha/configure-mapper

Conversation

@bitkid

@bitkid bitkid commented Jun 11, 2026

Copy link
Copy Markdown

Motivation:

this was not possible before.

@phile314

phile314 commented Jul 7, 2026

Copy link
Copy Markdown

Any chance that this is merged/released any time soon? It does block Jackson3 adaptation for us.

@bitkid

bitkid commented Jul 7, 2026

Copy link
Copy Markdown
Author

i think this PR has problems .. because it changes the objectmapper for the rest of the test suite. the clean solution would be to instantiate the mapper correctly, but that wasnt possible for jackson2 as well, so i thought i go for the low hanging fruit.

@vietj

vietj commented Jul 7, 2026

Copy link
Copy Markdown
Member

@phile314 I'm currently not happy modifying this on the fly and need to think about a proper way to implement this

what is your use case ?

@vietj

vietj commented Jul 7, 2026

Copy link
Copy Markdown
Member

perhaps we could make it available statically like the jackson 2 data bind codec class does

@phile314

phile314 commented Jul 8, 2026

Copy link
Copy Markdown

We register custom modules with Jackson (special datatype conversions, null handling). As the Object Mapper is immutable with Jackson3, I do not see any way to do that with Vertx and Jackson 3 right now. Maybe I am missing something?

In the end, we probably will just call Jackson directly ourselves without the detour via Vertx to work around this issue.

@vietj

vietj commented Jul 8, 2026

Copy link
Copy Markdown
Member

@phile314 makes sense to do like that, however I think that doing that the field then should not be final anymore but should be volatile instead to ensure visibility

public class DatabindCodec extends JacksonCodec {

private static final ObjectMapper mapper = JsonMapper
private static ObjectMapper mapper = JsonMapper

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field should be come volatile

return mapper;
}

public static void updateMapper(Function<MapperBuilder<ObjectMapper, ?>, ObjectMapper> f) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather name it rebuildMapper as this is what it does

return mapper;
}

public static void updateMapper(Function<MapperBuilder<ObjectMapper, ?>, ObjectMapper> f) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add javadoc also explaining what the method does

@vietj vietj added this to the 5.2.0 milestone Jul 8, 2026
@bitkid

bitkid commented Jul 8, 2026

Copy link
Copy Markdown
Author

like with all static things i see problems when running the testsuite in parallel

@vietj

vietj commented Jul 8, 2026 via email

Copy link
Copy Markdown
Member

@bitkid

bitkid commented Jul 9, 2026

Copy link
Copy Markdown
Author

updated the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants