[SOLVED] Caused by: java.awt.HeadlessException when trying to create a SWING/AWT frame from Spring Boot

In Spring Boot, when you try to create a Swing frame from the component that is the entry point of your app, you will get
[code]Caused by: java.awt.HeadlessException[/code]

To solve this, in your Application class in main, instead of:

SpringApplication.run (Application.class, args)


SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
ConfigurableApplicationContext context = builder.run(args);

Leave a Reply

Your email address will not be published. Required fields are marked *