<p>I have to inject DB URL, DB Username and Password variables into a Java Spring Boot Application. I know that these properties reside in the application.properties file under res/ folder.</p>
<p>Now as a design change I want to adopt K8s ConfigMaps and Secrets to be used in place of hardcoding in the the application.properties file.</p>
<p>How can I link the CMs and Secrets from K8s to the application. How should I set placeholders in application.properties file?</p>
<p>Does defining the CM and Secret dependency in application deployment.yaml does everything?</p>

<p>First you need to enable <code>spring.cloud.kubernetes.secrets.enabled</code>
then you can use Kubernetes Secrets via <code>SecretsPropertySource</code>.</p>
<p>You can use secret name via: <code>-Dspring.cloud.kubernetes.secrets.name=my-secret</code>
where <code>my-sercret</code> is name of a secret which is defined in kubernetes.
or you can access it in multiple other methods described in the <a href="https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/1.0.0.M2/multi/multi__secrets_propertysource.html" rel="nofollow noreferrer">Documentation</a>.</p>
