Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
789 B
2
Indexable
Never
@Configuration
public class AWSS3ClientConfig {
    @Value("xxx")
    private String endpointUrl;

    @Value("xxx")
    private String awsAccessKey;

    @Value("xxx")
    private String awsSecretKey;

    @Value("xxx")
    private String region;
    @Bean
    public AmazonS3 s3client() {
        BasicAWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);

        return AmazonS3ClientBuilder.standard()
                .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpointUrl, region))
                .withPathStyleAccessEnabled(true)
                .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
                .withChunkedEncodingDisabled(true)
                .build();
    }

}
Leave a Comment