我正在使用Amazon s3服务上传文件。现在我想从amzone转移到数字海洋空间。
这是我现有的AmazonS3Client配置。
<bean id="amazonS3RepositoryService" class="com.xx.service.impl.RepositoryAmazonS3Impl">
<constructor-arg>
<bean class="com.amazonaws.services.s3.AmazonS3Client">
<constructor-arg>
<bean class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg value="${amazon.accessKey}"/>
<constructor-arg value="${amazon.accessSecret}"/>
</bean>
</constructor-arg>
</bean>
</constructor-arg>
<property name="bucket" value="${amazon.bucket}"/>
</bean>
当我用Google搜索时,我看到以下解决方案有效。如何使用以下代码更新xml配置?
AWSCredentialsProvider doCred = new AWSStaticCredentialsProvider(new BasicAWSCredentials("XXX", "YYY"));
AmazonS3 doBuckets = AmazonS3ClientBuilder.standard()
.withCredentials(doCred)
.withEndpointConfiguration(new EndpointConfiguration("https://nyc3.digitaloceanspaces.com", "nyc3"))
.build();