0

我们正在开发 Spring Boot 应用程序以连接 AWS S3。

  final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);


        AmazonS3 s3client = AmazonS3ClientBuilder.standard()
                .withRegion(Regions.US_WEST_2)
                .withCredentials(new AWSStaticCredentialsProvider(credentials))
                .build();

在创建 AwsCredentials 对象行本身时,我们面临以下问题

java.lang.SecurityException: class "com.amazonaws.auth.BasicAWSCredentials"'s signer information does not match signer information of other classes in the same package

我们不明白这是什么问题?

所以任何人都知道问题是什么以及如何解决这个问题?

4

1 回答 1

0

有一些 AWS 教程讨论了如何从 Spring Boot 应用程序与 Amazon S3 交互。

您的代码是 V1,所有 AWS 当前教程都是 V2。我建议使用适用于 AWS 版本 2 的 Java 开发工具包。

这是一个 AWS 教程,向您展示如何创建与 Amazon S3 交互的 Spring Boot 应用程序。除了 S3,此示例应用程序还使用以下 AWS 服务:

  • 亚马逊识别
  • 亚马逊 SES
  • AWS Elastic Beanstalk

要了解如何使用 AWS SDK for Java V2 开发调用 Amazon S3 和其他服务的 Spring Boot 应用程序,请参阅此 URL: https ://github.com/awsdocs/aws-doc-sdk-examples/tree/master /javav2/usecases/creating_photo_analyzer_app

于 2021-01-05T15:18:56.220 回答