美文网首页技术雷达
[SOLVED] Caused by: java.awt.Hea

[SOLVED] Caused by: java.awt.Hea

作者: 光剑书架上的书 | 来源:发表于2018-09-30 18:24 被阅读20次

[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

Caused by: java.awt.HeadlessException

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

SpringApplication.run (Application.class, args)

use

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

相关文章

网友评论

    本文标题:[SOLVED] Caused by: java.awt.Hea

    本文链接:https://www.haomeiwen.com/subject/zwawoftx.html