Spring Boot AWT异常

0

java.awt.HeadlessException: null
	at java.desktop/java.awt.TrayIcon.<init>(TrayIcon.java:142)
	at java.desktop/java.awt.TrayIcon.<init>(TrayIcon.java:169)
	at java.desktop/java.awt.TrayIcon.<init>(TrayIcon.java:198)
	at acgist.killer/com.acgist.killer.window.menu.TrayMenu.enableTray(TrayMenu.java:137)
	at acgist.killer/com.acgist.killer.window.menu.TrayMenu.<init>(TrayMenu.java:49)
	at acgist.killer/com.acgist.killer.window.menu.TrayMenu.getInstance(TrayMenu.java:41)
	at acgist.killer/com.acgist.killer.window.main.MainWindow.enableTray(MainWindow.java:34)
	at acgist.killer/com.acgist.killer.window.main.MainWindow.start(MainWindow.java:26)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
	at java.base/java.lang.Thread.run(Thread.java:834)

Spring Boot项目里面有AWT的代码时,提示以上异常,解决办法修改Spring Boot启动参数:

		SpringApplicationBuilder builder = new SpringApplicationBuilder(AcgistKillerApplication.class);
	    builder
	    	.headless(false) // 注意这里
//	    	.web(WebApplicationType.NONE)
	    	.build()
	    	.run(args);