'Injecting value into a YAML placeholder that is in a Map
I have a YAML file in my config server that stores a map
demo-config:
creds:
user1: pass1word, pass2word
user2: pass1word, pass2word
user3: pass2word
I have a pojo for that
@Data
@RefreshScope
@ConfigurationProperties(prefix = "demo-config")
public class Credentials {
private Map<String, String> creds;
}
Now, I want to modify my code and change so that I can inject the 1 or 2 from back-end according to my business conditions.
My config file will have placeholders
demo-config:
creds:
user1: pass${type}word, pass${type}word
user2: pass${type}word, pass${type}word
user3: pass${type}word
Is it possible to put placeholders in between property values and change their values using a setter method?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
