Last active
December 6, 2024 12:55
-
-
Save rgielen/bbbe15fe9955e862e4833dcb48d1b157 to your computer and use it in GitHub Desktop.
Spring Boot + JavaFX Platform.startup prototype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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