'Spring dynamic properties name

I'm wondering if I can use dynamic properties name (for instance, using environment variables).

I want to use @ConfigurationProperties for injecting keys and values to HashMap. I tried it this way, but it didn't work.

application.yaml:

my-properties:
     ${my-env-variable-1}: env-1-value
     ${my-env-variable-2}: env-2-value


Sources

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

Source: Stack Overflow

Solution Source