-
Notifications
You must be signed in to change notification settings - Fork 910
Equivalent of com.amazonaws.util.json.Jackson
in sdk v2
#5251
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
Comments
Hi, I did some research and found that the AWS SDK for Java 2.7 removed its external dependency on Jackson. You can read more about this in this blog post. The change is also discussed in these pull requests: #2598 and #2522. I analyzed your code and it looks like a quick fix. Currently, we are using Jackson.convertValue() to convert from one object to another in the deserializeConfig() method:
We can modify this line to use other third-party converters like ModelMapper, etc. to achieve the same result. You haven’t shared the AwsKeyPairConfig class definition, so I couldn't look into it further. |
In case you don't want to use third-party libraries discussed in previous comment to convert one object into another, you can use ObjectMapper class. Documentation here.
|
I added in the description the definition of the The solution with the
|
Region is an immutable class and it doesn't have a default (no argument) constructor. So, object mapper cannot create instance of it and deserialize. I am not sure if not having a no argument constructor is a design choice or a bug. @debora-ito can comment on this. Having said that, there are a few other options that you can try.
Hope it helps! |
I implemented the deserialization manually, though I am curious to hear if not having a no argument constructor is a design choice or a bug |
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue
I am trying to migrate some code from the SDK v1 to the SDK v2 and one of the last hurdle is the following piece of code:
The classes involved are:
and
What is the equivalent to use in the SDK v2, I did not find anything about it in the documentation, except this opened discussion: #3904 and this issue #2254
Thanks in advance
Links
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-serialization-changes.html
The text was updated successfully, but these errors were encountered: