-
Notifications
You must be signed in to change notification settings - Fork 61
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
Allow for multiple JSON providers #354
Comments
If you want a different implementation of provider you can do it with System property: -Djakarta.json.provider=your.custom.Implementation The problem of this is that the property will affect everywhere, and maybe you want to use a different implementation in another webapp running in the same JVM process. You can also make a new instance of your custom implementation, instead of delegating it to the JsonProvider. To know the name of the loaded implementation you can do the next: JsonProvider.provider().getClass().getName() Do you mean that we could add a new method in JsonProvider.provider(String name) and then check that argument when iterating the ServiceLoader?:
|
Could you check if this is what you wanted, please?: |
The proposed edits are fine. This allows to load different providers. Great! |
In some cases there may be multiple providers, for instance one that comes with the Maven dependencies, and one that I explicitly want to use. To allow the loading of a specific provider,
JsonProvider
should have agetName()
method that returns the name of the provider. The name can be use to select a specific provider.The text was updated successfully, but these errors were encountered: