在启动类添加System.setProperty(“java.awt.headless”,“true”);
public static void main(String[] args) {
ApplicationContext applicationContext = new SpringApplicationBuilder(DoorApp.class).headless(false).run(args);
Environment env = applicationContext.getEnvironment();
System.setProperty("java.awt.headless","true");
}