title: Spring integration test with custom application context
body: <p>For my application I created my own type of <code>ApplicationContext</code> that allows me to interact in specific manners that are needed for may application. As the application is a desktop application, I create the context like this:</p>
  
  <pre><code>@SpringBootApplication
  @Import(StandaloneConfiguration.class)
  @PropertySource(value = {"application.properties", "server.properties"})
  public class OpenPatricianApplication extends Application {
      private ApplicationContext context;
      @Override
      public void init() {
          SpringApplicationBuilder builder = new SpringApplicationBuilder(OpenPatricianApplication.class);
          context = builder.contextClass(DependentAnnotationConfigApplicationContext.class).run(getParameters().getRaw().toArray(new String[0]));
          // more initialisation
  
          }
      }
  }
  </code></pre>
  
  <p>Now I want to create a Spring Boot integration test that actually relies on the functionality of my own <code>ApplicationConext</code> implementation.</p>
  
  <pre><code>@SpringBootTest(classes = {ServerTestConfiguration.class})
  public class ServerIntegrationTest {
      private DependentAnnotationConfigApplicationContext context;
  }
  </code></pre>
  
  <p>How do I go about initializing my <code>context</code> in the test? The <code>context</code> must be created in order to start the spring application for this to work, but with the <code>SpringBootTest</code> annotation this already happened, when the constructor is entered.
  Are there any additional annotations or parameter for existing ones that can be applied? Should tests of these nature not be annotated with <code>SpringBootTest</code> at all and the application created manually?</p>