fix(DesktopApplication): 修复Spring上下文初始化问题并清理无用代码
移除重复的SpringApplication.run调用,确保ConfigurableApplicationContext正确初始化。 将applicationContext声明为静态变量以供全局访问。 移除未使用的playwrightService字段和相关初始化代码。 保留JavaFX平台属性设置逻辑。 添加todo注释用于后续网络上报接口初始化。
This commit is contained in:
@@ -14,26 +14,22 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
//@SpringBootApplication
|
||||
@SpringBootApplication
|
||||
public class DesktopApplication extends Application {
|
||||
|
||||
private TextArea textArea;
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
private PlaywrightService playwrightService;
|
||||
private static ConfigurableApplicationContext applicationContext;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 设置JavaFX系统属性
|
||||
System.setProperty("javafx.application.platform", "egl");
|
||||
SpringApplication.run(DesktopApplication.class, args);
|
||||
applicationContext = SpringApplication.run(DesktopApplication.class, args);
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
super.init();
|
||||
applicationContext = (ConfigurableApplicationContext) SpringApplication.run(DesktopApplication.class);
|
||||
//playwrightService = applicationContext.getBean(PlaywrightService.class);
|
||||
playwrightService = new PlaywrightService();
|
||||
// todo 初始化应用程序网络上报接口
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user