Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only construct one object mapper instance per jvm #1149

Merged
merged 2 commits into from
Mar 4, 2023

Conversation

derklaro
Copy link
Member

@derklaro derklaro commented Mar 4, 2023

Motivation

At the moment there are two different instances of the object mapper used internally. An instance created by the dependency injection system, and an instance constructed specifically during the static initialization of the DefaultObjectMapper class.

Modification

Bind the specifically created instance into the boot injection layer when it's created for the first time. For this reason, this PR adds a new interface (BootLayerConfigurator) that can be used in combination with the SPI to configure the boot layer at the first creation. This interface is only used for the mapper instance at the moment, but might be nice in the future for other changes as well.

Result

The same object mapper instance is now passed to users which are using the static accessor field, as well as users that are using dependency injection. This also fixes issues with serializers that are only bound to one of these two instances.

Other context

Fixes #1112

@derklaro derklaro added t: bug Something isn't working as intended p: high This issue or pull request has a high priority. v: 4.X This pull should be included in the 4.0 release in: driver An issue/pull request releated to the driver module code labels Mar 4, 2023
@derklaro derklaro added this to the 4.0.0-RC8 milestone Mar 4, 2023
@derklaro derklaro requested a review from 0utplay March 4, 2023 12:44
@derklaro derklaro self-assigned this Mar 4, 2023
@0utplay 0utplay merged commit e835b25 into nightly Mar 4, 2023
@0utplay 0utplay deleted the duplicate-object-mapper-instance branch March 4, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: driver An issue/pull request releated to the driver module code p: high This issue or pull request has a high priority. t: bug Something isn't working as intended v: 4.X This pull should be included in the 4.0 release
Projects
None yet
2 participants