title: Can I inject properties from Maven (passwords defined in settings.xml) into my Spring container?
body: <p>I define passwords to servers via properties I define in my ~/.m2/settings.xml (could be anywhere, though, including pom.xml) for my deployment plugin. I'd like to use the same properties for my integration tests. Is there a way to do so?</p>
  
  <p>If not, is there a convenient way to share properties between Maven and TestNG?</p>
  
  <p>I want to write a nice test suite that can run on different continuous integration servers, pointing to different remote hosts (development, testing, staging, and production), without modification of the code.</p>
  
  <p>I am defining credentials to a remote service in settings.xml:</p>
  
  <pre><code>&lt;properties&gt;
  &lt;my.host&gt;http://my.company.com&lt;/my.host&gt;
  &lt;my.username&gt;my-un&lt;/my.username&gt;
  &lt;my.password&gt;my-pw&lt;/my.password&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>I'd like to be able to reference the properties in my unit/integration tests (src/test/resources) using:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans....
      &lt;bean class="java.lang.String" id="un"&gt;
          &lt;constructor-arg value="${my.username}"/&gt;
      &lt;/bean&gt;
      &lt;bean class="java.lang.String" id="pw"&gt;
          &lt;constructor-arg value="${my.password}"/&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Are there any options to doing this?  Has anyone else tried this before?  I am writing a lot of REST tests which require authorization in my tests.</p>
  
  <p>Thanks!</p>