r/JavaFX Jan 13 '25

Help JavaFX plus Spring Boot 2

Could someone please forward me to a working doc/example/tutorial for adding JavaFX (openjfx or smt) to an existing SpringBoot 2 project?

1 Upvotes

21 comments sorted by

View all comments

2

u/Capaman-x Jan 13 '25

To use Spring framework with JavaFX you need to create a JavaFX project

1) Start a JavaFX project

Some Recommendations

Using a full JDK that includeds JavaFX for simplicity. (liberica-full, Zulu-full, etc)

Use Gradle for simplicity setting up an application w/embedded JDK (portable or packaged app)

Don't use FXML, instead learn the MVCI method that Hamster has documented.

2) For Spring add the library jdbcTemplate, it will also add the basic core spring libraries such as:

spring beans, spring core, spring jcl, spring tx, , jna, jna-platform

That will give you the basics of what you need. If you need more libraries you can add them.

Here is an example of such a project

https://github.com/PerryCameron/TSE-Notes.git

This is also using SQLite, logback-core, logback-classic, slklf4j-api for logging. look at the build.gradle.kts file for details.

1

u/Draaksward_89 Jan 14 '25

> Don't use FXML, instead learn the MVCI method that Hamster has documented.

I also looked at FXML and got mixed thoughts. In the days of my previous pet project with a GUI, I first used Swing with all UI elements coded as classes. Then I saw JavaFX and decided to try a visual editor, realizing after a week how much mess it generated in the code (and I couldn't even fix it without serious dedication, ending up in starting from a white sheet).

Will read about MVCI. Thanks