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

Support different JsonMapper for different datasources #3161

Open
robsigler opened this issue Oct 4, 2024 · 1 comment
Open

Support different JsonMapper for different datasources #3161

robsigler opened this issue Oct 4, 2024 · 1 comment

Comments

@robsigler
Copy link

robsigler commented Oct 4, 2024

Feature description

I have a use-case where it would be helpful for Micronaut to support having different JsonMappers for different datasources. Specifically, I need to use a different JSON serialization strategy for a DataType.JSON field I am persisting with Micronaut Data JDBC datasource than the default JsonMapper that I use to serialize my API's HTTP responses, so if I could define a @Named JsonMapper and then configure a datasource to use a specific named JsonMapper instead, that would solve my problem!

@altro3
Copy link
Contributor

altro3 commented Oct 5, 2024

@dstepanov It would be nice to support it not only in micronaut-data. I think, better to add this functionality in core module and also add support custom object mapper on http client level. Maybe it's better to add configuration like http client by EachProperty annotation like this:

mappers:
  default:
    ...
  client1:
    ...
  client2:
    ...
  ds:
    ...

And this feature will be usefull without http clients and datasources. Sometimes you need multiple ObjectMappers just for business logic

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

No branches or pull requests

2 participants