title: Non static @BeforeClass equivalent when Spring unit test runner?
body: <p>I have multiple interconnected beans in configuration and would like to test various operation after global state changed.</p>
  
  <p>For example, I have <code>execute()</code> of some bean, after which many beans are changed.</p>
  
  <p>Currently I put all check inside <code>testExecute()</code> method, but this method becomes huge and non-separated.</p>
  
  <p>Is it possible to execute <code>execute()</code> before entire class run, i.e. just after context was initialized?</p>
  
  <p><code>@BeforeClass</code> methods should be static, while I need to have context already initialized and autowired. Is it possible?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Note, that running "before class" in Spring environment should also include control of when context initialization occurs. I.e. one may want to run some code before context initialized and after context initialized (but both cases before class).</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Also, Spring &amp; JUnit allows <code>@DirtiesContext</code> annotation, which means that context will be initialized again. In such cases, "before" methods should be called again and also in the appropriate order.</p>