my pom.xml
Код: Выделить всё
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.2.1
com.my-group
my-app
1.0
my-app
17
17
17
org.apache.httpcomponents.client5
httpclient5
5.2.1
org.openjfx
javafx-controls
19.0.2.1
org.openjfx
javafx-fxml
19.0.2.1
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-websocket
org.springframework.boot
spring-boot-devtools
runtime
true
org.springframework.boot
spring-boot-configuration-processor
true
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.security
spring-security-test
test
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
< /code>
Мой основной класс < /p>
package com.mygroup.myapp;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import java.awt.*;
@SpringBootApplication
public class MyApplication extends Application {
private ConfigurableApplicationContext applicationContext;
private Parent rootNode;
public static void main(String[] args) {
if (!SystemTray.isSupported()) {
System.setProperty("java.awt.headless", "false");
}
Application.launch(args);
}
@Override
public void init() throws Exception {
applicationContext = SpringApplication.run(MyApplication.class);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/login.fxml"));
fxmlLoader.setControllerFactory(applicationContext::getBean);
rootNode = fxmlLoader.load();
}
@Override
public void start(Stage primaryStage) {
Platform.setImplicitExit(false);
primaryStage.setResizable(false);
primaryStage.setScene(new Scene(rootNode));
primaryStage.show();
}
@Override
public void stop() {
applicationContext.close();
Platform.exit();
}
}
Подробнее здесь: https://stackoverflow.com/questions/777 ... pplication