I have secrets configured in config/yaml file. There is one secret value that is causing trouble. I just want to print out the value being injected:
apiVersion: v1
kind: ConfigMap
metadata:
name: myapplication-config
data:
config.yaml: |
'mysecret1': ${DB_PASSWORD}
'mysecret2': ${ANOTHER_SECRET}
I make a GET request to the controller to print out the secret:
@Autowired
Environment env;
@GetMapping("/test")
public String print(){
System.out.println(env.getProperty("mysecret2"));
}
When I print it, it throws an error:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'mysecret2' in value "${mysecret2}" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172)
Any idea how I can check the secrets sent to the application from config/env/dev/config.yaml?