net.rgielen.fxweaver.samples.springboot.starter.application.SpringbootJavaFxApplication Maven / Gradle / Ivy
The newest version!
package net.rgielen.fxweaver.samples.springboot.starter.application;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import net.rgielen.fxweaver.samples.springboot.starter.FxWeaverSpringBootStarterSampleApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
/**
* @author Rene Gielen
* @noinspection RedundantThrows
*/
public class SpringbootJavaFxApplication extends Application {
private ConfigurableApplicationContext context;
@Override
public void init() throws Exception {
this.context = new SpringApplicationBuilder()
.sources(FxWeaverSpringBootStarterSampleApplication.class)
.run(getParameters().getRaw().toArray(new String[0]));
}
@Override
public void start(Stage primaryStage) throws Exception {
context.publishEvent(new StageReadyEvent(primaryStage));
}
@Override
public void stop() throws Exception {
context.close();
Platform.exit();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy