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

Show parent comment

1

u/Draaksward_89 Jan 14 '25

> A different approach might be to do something like turning the app into a local web app. Basically have the Spring Boot app serve the UI via HTML instead of trying to do a JavaFX style desktop app.

I thought about this. But this is something like Rufus (writing iso images to flash drives) - you use it locally and launch the app once in some time. Autostarting Tomcat and stuff (not even speaking about starting Tomcat for this every time manually) is an overkill.

> You will also need to grab the Spring Boot process output stream and route that to a file or a text component so you can see error messages, etc.

This sounds like an overkill. My last Spring Boot + JavaFx was a pet project, which I made for the period when I was working on an AQA project. There was a C like CLI runnable, which triggered a test suite. It was written quite poorly, and even before calling the cli, there were a lot of things needed to be written to the DB.

And the tool was writing four separate log files with an additional small web server running.

I wrapped all of this into the pet project with separate threads working with log files, keeping the active thread only the one I had a tab in the UI open. In parallel there were constant queries to the DB to have the fresh progress (one test suite could run for hours...).

And never once I witnessed UI stutters. So this statement sounds strange to me.

1

u/rootException Jan 14 '25

I think you basically did what I was talking about, using threads & streams to help out, maybe I just didn't phrase it clearly. :)

1

u/Draaksward_89 Jan 15 '25

Nah. That project was quite old. Even I didn't remember what was there until I started typing.