Skip to content

Instantly share code, notes, and snippets.

@rgielen
Last active December 6, 2024 12:55
Show Gist options
  • Save rgielen/bbbe15fe9955e862e4833dcb48d1b157 to your computer and use it in GitHub Desktop.
Save rgielen/bbbe15fe9955e862e4833dcb48d1b157 to your computer and use it in GitHub Desktop.
Spring Boot + JavaFX Platform.startup prototype
@SpringBootApplication
public class JavafxWeaverSpringbootSampleApplication {
public static void main(String[] args) {
Platform.startup(() -> {
SpringApplication.run(JavafxWeaverSpringbootSampleApplication.class, args);
});
}
@Bean
public FxWeaver fxWeaver(ConfigurableApplicationContext applicationContext) {
return new SpringFxWeaver(applicationContext);
}
@Bean
CommandLineRunner commandLineRunner(FxWeaver fxWeaver) {
return args -> {
Stage stage = new Stage();
StageHelper.setPrimary(stage, true);
Scene scene = new Scene(fxWeaver.loadView(MainController.class), 400, 300);
stage.setScene(scene);
stage.show();
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment