title: Passing environment values in application.properties
body: <p>I am new to spring-boot and trying to pass the Backend credentials as environment values into my application.properties.</p>
  
  <p>To set the Environment values in Tomcat and created a setenv.bat and setenv.sh 
  Location: \apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin</p>
  
  <pre><code>set username="ABC"
  set password="xyz"
  </code></pre>
  
  <p>These Environment values are getting set and i am able to print it also using </p>
  
  <pre><code>@Autowired
  private Environment env;
  
  String userName = env.getProperty("username");
  String pwd = env.getProperty("password");
  </code></pre>
  
  <p>and trying to access these values in application.properties like</p>
  
  <pre><code>spring.datasource.username=${username}
  spring.datasource.password=${password}
  </code></pre>
  
  <p>but that is not working. 
  I tried the different way and mentioned the environment variables name in setEnv.bat like </p>
  
  <pre><code>set spring.datasource.username="ABC"
  set spring.datasource.password="xyz"
  </code></pre>
  
  <p>i was hoping that Spring Boot will read these values from Env and pass it to data source so that i do not have to mention explicitly in application.properties but that is also not working. please note, i do not have any bean.xml file and i am doing pure annotation based development. Any inputs here..</p>