因此,在我的大多数项目中,我使用Spring Dev Tools因为它允许我更改源代码并自动重新加载应用程序。我现在开发一个spring应用程序并使用JavaFX进行某些操作。但是,JavaFX Application类的launch(String ... args)方法不允许多次调用launch。当Spring Dev Tools尝试重新运行main方法时,它会抛出以下错误。有什么解决方法吗? spring应用程序上下文成功重新加载,但JavaFX的内容却没有。
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: Application launch must not be called more than once
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:162)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:143)
at javafx.application.Application.launch(Application.java:252)