How to interact with client only Spring Boot application

233 views Asked by At

Circumstances

I have a spring boot application that is not accessible via web (spring.main.web-environment=false). The purpose of using spring boot is to have an out of the box support for interacting with a database. Maybe a JPA layer alone would also have been sufficient, but I went for spring boot.

The program has a GUI (JavaFX), and this GUI interacts with the spring boot application whenever a DB interaction is necessary.

Question

Now I am a bit confused, how the GUI can interact with Spring Boot. I start Spring Boot, better to say the main application (@SpringBootApplication) at the startup of the program (in a Thread if that matters, as it must not block the GUI). So far so good. But how can I call methods in spring boot? My last project was a web project, and I used REST APIs with according Spring Boot Controllers, which allowed me to interact with Spring Boot via a e.g. a browser.

But now I am client only, and I want to call methods which do something within my Spring boot Application from the GUI, e.g. when a button is pressed.

Maybe this is answered easily, but I couldn't find how to do it properly. I built a solution with ApplicationRunner where every time a new spring boot application is started and closed after doing it's job, but this is not really elegant, and I am not able to retrieve parameters back with this technique.

0

There are 0 answers