'Read configuration not only from AWS secret manager but also from environment parameters

I have a Spring boot application which read configuration from environment parameters. However, part of the environment parameters needs to be put in AWS secret manager to protect it from being accessed by unwanted role.

After setting AWS related logic, the rest parameters that are supposed to be loaded from environment parameters are null. I checked there can be multiple sources for BootstrapConfiguration. What shall I put to load the rest parameters from environment?

org.springframework.cloud.bootstrap.BootstrapConfiguration=configuration.AwsSecretsManagerBootstrapConfiguration



@Configuration
@EnableConfigurationProperties(AwsSecretsManagerProperties.class)
@ConditionalOnClass({ AWSSecretsManager.class })
@ConditionalOnProperty(prefix = AwsSecretsManagerProperties.CONFIG_PREFIX, name = "enabled", matchIfMissing = true)
public class AwsSecretsManagerBootstrapConfiguration {
    public static final String REGION = "<region_name>";

    @Bean
    @ConditionalOnMissingBean
    AWSSecretsManager smClient() {
        return AWSSecretsManagerClientBuilder.standard().withRegion(REGION).build();
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source