title: How do I read JVM arguments in the Spring applicationContext.xml
body: <p>I have a JSF web application with Spring and I am trying to figure out a way to reference the JVM arguments from the applicationContext.xml. I am starting the JVM with an environment argument (-Denv=development, for example). I have found and tried a few different approaches including:</p>
  
  <pre><code>&lt;bean id="myBean" class="com.foo.bar.myClass"&gt;
    &lt;property name="environment"&gt;
      &lt;value&gt;${environment}&lt;/value&gt;
    &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>But, when the setter method is invoked in MyClass, the string "${environment}" is passed, instead of "development". I have a work around in place to use System.getProperty(), but it would be nicer, and cleaner, to be able to set these values via Spring. Is there any way to do this?</p>
  
  <p>Edit:
  What I should have mentioned before is that I am loading properties from my database using a JDBC connection. This seems to add complexity, because when I add a property placeholder to my configuration, the properties loaded from the database are overridden by the property placeholder. I'm not sure if it's order-dependent or something. It's like I can do one or the other, but not both.</p>
  
  <p>Edit:
  I'm currently loading the properties using the following configuration:</p>
  
  <pre><code>&lt;bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
      &lt;property name="jndiName" value="jdbc.mydb.myschema"/&gt; 
  &lt;/bean&gt;
  
  &lt;bean id="props" class="com.foo.bar.JdbcPropertiesFactoryBean"&gt;
      &lt;property name="jdbcTemplate"&gt;
          &lt;bean class="org.springframework.jdbc.core.JdbcTemplate"&gt;
              &lt;constructor-arg ref="myDataSource" /&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;context:property-placeholder properties-ref="props" /&gt;
  </code></pre>