title: Prevent Application / CommandLineRunner classes from executing during JUnit testing
body: <p>If in your TestCase class there is this annotations:</p>
  
  <pre><code>@SpringApplicationConfiguration(classes = {Application.class})
  </code></pre>
  
  <p>this will cause the <code>Application.class</code>, implementing the <code>CommandLineRunner</code> interface, to run the required method</p>
  
  <pre><code>public void run(String... args) throws Exception
  </code></pre>
  
  <p>I still think this is, mostly, a not wanted behaviour, since in your test environment you may not want to launch the entire application.</p>
  
  <p>I have in mind two solution to circumvent this problem:</p>
  
  <ol>
  <li>to remove the <code>CommandLineRunner</code> interface from my <code>Application</code> class</li>
  <li>to have a different context for testing</li>
  </ol>
  
  <p>Both this solution requires lot of coding.
  Do you have a more convenient solution?</p>