问题
I'm trying to write a DAO for DynamoDB using Java 8 and there seems to be several ways. Classes are primarily defined under the following two packages:
com.amazonaws.services.dynamodbv2
software.amazon.awssdk.services.dynamodb
Both of them appear to be doing what I'd like - but since I'm starting fresh, I'd rather choose the latest one
I've looked at these two links:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Java.03.html
https://docs.aws.amazon.com/sdk-for-java/v2/migration-guide/whats-different.html
The thing that confuses the most is that the com.amazonaws.services.dynamodbv2.AmazonDynamoDB
says v2 and software.amazon.awssdk.services.dynamodb.DynamoDbClient
doesn't.
回答1:
The aws-sdk-java-v2 repository uses the package name software.amazon.awssdk
whereas v1 of the Java SDK uses com.amazonaws
. v2 was written with Java 1.8 features in mind, making it a lot easier to develop with over v1.
I personally recommend using v2 over v1 where possible, even though both SDKs are still actively maintained on GitHub. However, there may be features that are missing from v2 that are contained in v1, so it's possible that you'll end up adding both as dependencies to your project.
To answer your question, com.amazonaws.services.dynamodbv2
is a package in v1 of the Java SDK, as seen here.
来源:https://stackoverflow.com/questions/57433717/which-jar-to-use-for-dynamodb-with-java