<p>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:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
name: myapplication-config
data:
  config.yaml: |
    'mysecret1': ${DB_PASSWORD}
    'mysecret2': ${ANOTHER_SECRET}
</code></pre>
<p>I make a GET request to the controller to print out the secret:</p>
<pre><code>@Autowired
Environment env;

@GetMapping(&quot;/test&quot;)
public String print(){
  System.out.println(env.getProperty(&quot;mysecret2&quot;));
}
</code></pre>
<p>When I print it, it throws an error:</p>
<blockquote>
<p>Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'mysecret2' in value &quot;${mysecret2}&quot;
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172)</p>
</blockquote>
<p>Any idea how I can check the secrets sent to the application from config/env/dev/config.yaml?</p>

Faraz
<p>I was able to read them thru environment variable:</p>

<pre><code>@Autowired 
private org.springframework.core.env.Environment env;

//inside some method
@GetMapping("/test")
public String print(){
  System.out.println(env.getProperty("mysecret2"));
}
</code></pre>

<p>I tried using below but that didn't work.</p>

<pre><code>@Value("${mysecret2})
private String mySecret2; //didn't work

....

System.getEnv("mySecret2"); //didn't work
System.getProperty("mySecret2"); //didn't work
</code></pre>
