Description: I have three config files in s3 bucket based on different profiles application.yml application-local.yml application-test.yml

but when I run the application, spring config server is looking for application-awss3.yml file.

When I debug in the config-server API in class AwsS3EnvironmentRepository.java in findOne method

    final String application = StringUtils.isEmpty(specifiedApplication)
            ? serverProperties.getDefaultApplicationName() : specifiedApplication;
    final String profile = StringUtils.isEmpty(specifiedProfile)
            ? serverProperties.getDefaultProfile() : specifiedProfile;
    final String label = StringUtils.isEmpty(specifiedLabel)
            ? serverProperties.getDefaultLabel() : specifiedLabel;
    StringBuilder objectKeyPrefix = new StringBuilder();
    if (!StringUtils.isEmpty(label)) {
        objectKeyPrefix.append(label).append("/");
    }
    objectKeyPrefix.append(application).append("-").append(profile);

With above code I cannot use different profile. Please let me know how I can surpass this issue. Thanks

Comment From: spencergibb

where is awss3 profile configured?

"when I run the application" what application?

Comment From: srikanth550

Bootstrap.yml

spring:
  profiles:
      active: awss3
  cloud:
    config:
      server:
        awss3:
          region: us-east-1
          bucket: sample-bucket
        default-label: sample-config
        default-profile: test
        default-application-name: awss3-demo
        bootstrap: true

I am embedding spring cloud config server in my spring boot application with above configuration. I am using S3 as backend for cloud config server.

Comment From: spencergibb

spring.profiles.active is the default as you are embedding it. You need to set spring.cloud.config.profile.

Comment From: srikanth550

spring.profiles.active is the default as you are embedding it. You need to set spring.cloud.config.profile.

Issue is solved after adding spring.cloud.config.profile. Thank you.

Comment From: AnthonyCavanagh

I tried this and it did not work

server.port: 8080

spring:
  profiles:
    active: @activatedProperties@
  application: 
    name: HP-FETCHER-CONFIG-SERVICE

  cloud:
    config:
      profile: awss3
      server:
        awss3:
          bucket: hp-fetcher-config
          region: us-west-2
          order: 1