Class S3Config

java.lang.Object
com.example.blogs.app.config.S3Config

@Configuration public class S3Config extends Object
Configuration class for AWS S3 client with support for custom endpoints and path-style access.
  • Constructor Details

    • S3Config

      public S3Config()
  • Method Details

    • localS3Client

      @Bean @Profile("local") public software.amazon.awssdk.services.s3.S3Client localS3Client(@Value("${aws.region}") String region, @Value("${aws.accessKey}") String accessKey, @Value("${aws.secretKey}") String secretKey, @Value("${aws.endpoint}") String endpoint)
      Creates an S3 client configured for local development with custom endpoint. Active only in the local profile for integration with LocalStack or similar services.
      Parameters:
      region - the AWS region
      accessKey - the AWS access key
      secretKey - the AWS secret key
      endpoint - the custom S3 endpoint URL
      Returns:
      configured S3Client instance with path-style access enabled
    • prodS3Client

      @Bean @Profile("prod") public software.amazon.awssdk.services.s3.S3Client prodS3Client(@Value("${aws.region}") String region)
      Creates an S3 client configured for production with default AWS credentials. Active only in the production profile and uses IAM roles or default credential chain.
      Parameters:
      region - the AWS region
      Returns:
      configured S3Client instance with default credentials