title: How to pass heroku config var to spring boot's application.properties?
body: <p>I'm trying to pass custom heroku config variable into application.properties but no value is passed.</p>
  
  <p>My application.properties entry:</p>
  
  <pre><code>spring.mail.username=${SPRING_MAIL_SENDER_USERNAME}
  </code></pre>
  
  <p>Then I inject this value into String variable:</p>
  
  <pre><code>@Value("${spring.mail.username}")
  private String SENDER_MAIL_USERNAME;
  </code></pre>
  
  <p>but the SENDER_MAIL_USERNAME is an empty string when I try to use it.</p>
  
  <p>I can get the proper value like this:</p>
  
  <pre><code>System.getenv("SPRING_MAIL_SENDER_USERNAME");
  </code></pre>
  
  <p>but this is not what I'm looking for. Anyone knows what I'm doing wrong here?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Maybe it's worth to add that my project uses maven with 2 modules (backend and frontend). Simplified project structure looks like this:</p>
  
  <pre><code>-app  
    -backend  
      -src.main  
        -java.com.jakubeeee.app  
          -some java files...  
        -resources  
          -application.properties  
    -frontend  
      -src   
        -some web files...  
  </code></pre>
  
  <p>I also use Procfile that contains:  </p>
  
  <pre><code>web: java -Dserver.port=$PORT -jar $PATH_TO_JAR
  </code></pre>
  
  <p>where $PATH_TO_JAR is heroku config variable with value:</p>
  
  <pre><code>backend/target/myjarname.jar
  </code></pre>