https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.HowTo.SDK.html中有一个EnableDynamoDBAutoscaling示例。
但是,使用此示例会导致该行的一个弃用警告:
static AWSApplicationAutoScalingClient aaClient = new AWSApplicationAutoScalingClient();
如何避免这种弃用的警告?
答案 0 :(得分:0)
查看aws-sdk库源代码,您尝试过的调用已弃用,您希望使用以下API
AWSApplicationAutoScalingClientBuilder#defaultClient()
e.g。
static AWSApplicationAutoScalingClient aaClient = AWSApplicationAutoScalingClientBuilder.defaultClient().build();
答案 1 :(得分:0)
因此,使用端点配置,此代码对我有用:
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("http://localhost:8000",
Regions.US_EAST_1.toString());
AWSApplicationAutoScalingClient aaClient = (AWSApplicationAutoScalingClient) AWSApplicationAutoScalingClientBuilder
.standard().withEndpointConfiguration(endpointConfiguration).build();