title: spring.datasource.password from system property not working
body: <p>I used to complete sample from <a href="https://github.com/spring-guides/gs-accessing-data-jpa" rel="nofollow noreferrer">Spring Data</a>...</p>
  
  <p>It works well.</p>
  
  <p>I added application.properties</p>
  
  <pre><code>#spring.datasource.url=jdbc:h2:mem:testdb
  spring.datasource.url=jdbc:h2:file:./h2/demo
  spring.datasource.driverClassName=org.h2.Driver
  spring.datasource.username=sa
  spring.datasource.password=wrong
  spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
  </code></pre>
  
  <p>I worked (apparently on first run it creates the database with whatever password defined).</p>
  
  <p>When I changed the password to <code>newWrong</code> it started failing as expected (so I verified it's checking password).</p>
  
  <p>Now I changed the property file to contain</p>
  
  <pre><code>spring.datasource.password=#{systemProperties['pass']}
  </code></pre>
  
  <p>and I changed the <code>AccessingDataJpaApplication</code>'s main to:</p>
  
  <pre class="lang-java prettyprint-override"><code>public static void main(String[] args) {
      System.setProperty("pass", "wrong" );
      SpringApplication.run(AccessingDataJpaApplication.class);
  }
  </code></pre>
  
  <p>and it is not working - still complaining about the password.</p>
  
  <p>On the other hand, when I added</p>
  
  <pre><code>@Value("${bar}")
  String foo;
  </code></pre>
  
  <p>and defined in application properties (and used <code>wrong</code> for password to prevent failing)</p>
  
  <pre><code>bar=#{systemProperties['pass']}
  </code></pre>
  
  <p>this statement in Application class</p>
  
  <pre><code>System.out.println("foo: " + foo);
  </code></pre>
  
  <p>prints <code>foo: wrong</code>.</p>
  
  <p>Why the same is not working for <code>spring.datasource.password</code> property?</p>