Add option to set property prefix on Parameter Store property sources #927
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Added the ability to specify a property prefix for parameter store property sources. This replicates the functionality recently added for secrets manager property sources (see #621, #622, #630). I pulled heavily from the secrets manager prefix implementation written by @snigdhasjg and @maciejwalkowiak to try to keep the code and documentation consistent 🤓
💡 Motivation and Context
When multiple parameter store paths are imported that contain the same key, properties will be overwritten.
For example:
/config/my-db/url
=jdbc:mysql://localhost:3306
/config/my-db/username
=mysql-user
/config/another-db/url
=jdbc:postgresql://localhost:5432/postgres
spring.config.import=aws-parameterstore:/config/my-db/;/config/another-db/
results in the following properties:url
=jdbc:postgresql://localhost:5432/postgres
username
=mysql-user
Additionally users might want to add a prefix to their parameters for improved readability or to match autoconfig conventions. With the above properties, you can now do
spring.config.import=aws-parameterstore:/config/my-db/?prefix=spring.datasource.
resulting in properties:spring.datasource.url
=jdbc:mysql://localhost:3306
spring.datasource.username
=mysql-user
💚 How did you test it?
📝 Checklist
🔮 Next steps