title: Access application.properties from messages.properties
body: <p>I need to access properties from application.properties in messages.properties:</p>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>max-size=3
  </code></pre>
  
  <p><strong>messages.properties</strong></p>
  
  <pre><code>alert.error=You can only save {max-size} items.
  </code></pre>
  
  <p>Not working:</p>
  
  <pre><code>{max-size}, #{max-size}, ${max-size}
  </code></pre>
  
  <p>I am aware of <a href="https://stackoverflow.com/questions/14252159/how-to-access-properties-from-messages-properties-file-in-spring-controller-usin">this</a> thread, but I need it outside of any Java file.</p>
  
  <p><strong>Update:</strong> the maven approach works within application.properties files but not between application.properties and messages.properties. Shouldn't there be an order? If file A has key a but when file B is parsed first a is not available in B yet, is it?</p>
  
  <p>Snippet from my pom.xml:</p>
  
  <pre><code>&lt;build&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
                  &lt;includes&gt;
                      &lt;include&gt;**/*.properties&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/resource&gt;
  </code></pre>
  
  <p>"#{alert.error(${@environment.getProperty('max-size')})}"</p>