title: How to set environment variable or system property in spring tests?
body: <p>I'd like to write some tests that check the XML Spring configuration of a deployed WAR. Unfortunately some beans require that some environment variables or system properties are set. How can I set an environment variable before the spring beans are initialized when using the convenient test style with @ContextConfiguration?</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = "classpath:whereever/context.xml")
  public class TestWarSpringContext { ... }
  </code></pre>
  
  <p>If I configure the application context with annotations, I don't see a hook where I can do something before the spring context is initialized.</p>