Spring Application Context in JavaFX Application
<p>I interested in using a <code>ApplicationContext</code> in a JavaFX application. I ask myself if there is a smarter way to handle the <code>ApplicationContext</code> as an attribute of <code>Application</code> subclass itself.</p>

<pre><code>@Configuration
@ComponentScan("...")
public class Gui extends Application {

   private AnnotationConfigApplicationContext context;

   public static void main(String[] args) {
     launch(args);
   }

   /* (non-Javadoc)
    * @see javafx.application.Application#start(javafx.stage.Stage)
    */

    @Override
    public void start(Stage stage) throws Exception {       
      context = new AnnotationConfigApplicationContext(Gui.class);
      //...         
    }       
}
</code></pre>

<p>I purpose to separate the <code>ApplicationContext</code> from <code>Gui.class</code> and furthermore to use the <code>@Autowired</code> annotation for the injection of spring components in the <code>Gui.class</code>.</p>