title: How do you modify values in java properties file
body: <p>I have a config.properties file which contains configurable properties e.g. database connection details in a webapp deployed on tomcat. e.g.</p>
  
  <pre><code>local.driver: com.mysql.jdbc.Driver
  local.username:myuser
  local.password:mypass
  
  dev.driver: com.mysql.jdbc.Driver
  dev.username:mydevuser
  dev.password:mydevpass
  </code></pre>
  
  <p>I can retrieve the values from config.properties using spring Environment object or @Value. 
  My question is how do you make Spring's environment object pick local properties when running on local and dev properties when running on dev? Also it doesn't sound right to save sensitive data e.g. production database connection
  details in properties file which will float around in code base. So how do you add production detail when in production environment? Ideally I would want to change them as and when I like and not have to redeploy the app. Am I going the right direction?</p>
  
  <p>Note - All the answers I have seen on SO discuss changing these properties within java code. I don't want to do that I want to be able to configure these values independent of the application code.</p>
  
  <p>Thanks</p>