title: Where to put SwingUtilities.invokeLater in Spring backed java standalone application?
body: <p>I am using Spring framework for my java Swing application. I am initializing my MVC objects as spring bean in my application-context.xml in this way, with @Autowired for DI.</p>
  
  <pre><code>&lt;bean id="model" class="com.Model"/&gt;
  
  &lt;bean id="view" class="com.View"/&gt;
  
  &lt;bean id="controller" class="com.Controller"/&gt;
  </code></pre>
  
  <p>It runs successfully without any problem. However by reading at <a href="https://stackoverflow.com/questions/15302085/why-to-use-swingutilities-invokelater-in-main-method">this question</a>, I think I should put every Swing components inside SwingUtilities.invokerLater() for this reason.</p>
  
  <blockquote>
    <p>Some Swing component methods are labelled "thread safe" in the API specification; these         can be safely invoked from any thread. All other Swing component methods must be invoked   from the event dispatch thread. Programs that ignore this rule may function correctly most of the time, but are subject to unpredictable errors that are difficult to reproduce.</p>
  </blockquote>
  
  <p>So my question is, where/how to put my stuff to this Event Dispatch Thread? Currently my main method is just a one liner...</p>
  
  <pre><code>ApplicationContext context =
      new ClassPathXmlApplicationContext("application-context.xml");
  </code></pre>
  
  <p>UPDATE:
  I wanna know if this is what I should do?</p>
  
  <pre><code>SwingUtilities.invokeLater(new Runnable() {
    public void run() {
       ApplicationContext context =
          new ClassPathXmlApplicationContext("application-context.xml");
    }
    context.xxxx
    blahblahblah...
  });
  </code></pre>