In my spring boot application I have some externalized configuration properties read from AWS Parameter Store. I do not use AWS SSM Client directly and extract the properties. I am using the spring-cloud-starter-aws-parameter-store-config and with few bootstrap.yml changes I am able to configure it. When the application starts, I am able to automatically detect the environment property source and extract configuration values with the help of @ConfigurationProperties annotation.
Sample bootstrap.yml is shown below:
aws:
paramstore:
enabled: true
name: my-app
prefix: /config
profileSeparator: /
Sample code is shown below:
@Getter
@Setter
@Configuration
@ConfigurationProperties("app.property")
public class TestObject {
private Map<String, InnerObject> valueMap = new HashMap<>();
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public static class InnerObject {
private int property_one = 20;
private int property_two = 10;
}
}
Sample AWS Parameter Store configuration name:
/config/my-app/dev/app.property.valueMap
All other properties (String & StringList) works fine except with map. I was unable to figure out the way to define this map as a value within the AWS Parameter Store such that it resolves into my Java HashMap. Your insights are highly appreciated, thank you!