Skip to content

Spring Boot Sample

Eugene Ryzhikov edited this page Dec 31, 2021 · 2 revisions
@SpringBootApplication
@ComponentScan("com.gluonhq.ignite.spring")
public class SpringBootApplication extends Application implements ExampleApp {

	public static void main(String[] args) {
		Application.launch(SpringBootApplication.class, args);
	}

	@Autowired
	private FXMLLoader fxmlLoader;

	private final SpringContext context = new SpringContext(this);

	@Override
	public void start(Stage stage) throws IOException {
		context.init( () -> SpringApplication.run(SpringBootApplication.class));
		fxmlLoader.setLocation(getViewLocation());
                Parent view = fxmlLoader.load();

               primaryStage.setTitle("Spring Boot Example");
               primaryStage.setScene(new Scene(view));
               primaryStage.show();
	}

}

@Configuration
class SpringConfig  {
    @Bean
    public Service provideService() {
        return new Service();
    }
}
Clone this wiki locally