Search code examples
javaspring-bootyamlspring-cloud-aws

How cloud spring boot uses properties in yml file


When using Spring Cloud AWS for a repo, I noticed application.yml contains

spring:
  profiles: aws
  cloud:
    config:
      enabled: false
aws:
  paramstore:
    prefix: /micro
    name: microapp
    profileSeparator: #
    enabled: true

But I couldn't find where these properties are used. Usually, yml properties are imported via @Value or @ConfigurationProperties, but here there's no such an annotation used for them in the repo.

The pom.xml file had spring-cloud-starter-aws and spring-cloud-starter-aws-parameter-store-config dependencies, which I guessed used the properties.

Whenever I added a custom property, such as aws.smb.enable, pom.xml complained of 'unknown properties'.

I don't actually know how the properties in the yaml file work with Spring Cloud AWS.


Solution

  • But I couldn't find where these properties are used. Usually, yml properties are imported via @Value or @ConfigurationProperties, but here there's no such an annotation used for them in the repo.

    Which repo are you looking in? The aws properties are read in the Spring Cloud AWS project. For example, the aws.paramstore properties are read in org.springframework.cloud.aws.paramstore.AwsParamStoreProperties using @ConfigurationProperties.

    All of the aws and cloud.aws properties are documented in the Spring Cloud AWS docs.