Which jar to use for Dynamodb with java

北慕城南 提交于 2021-01-27 04:32:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!