Issue
I created a console app that read user input as parameter and pass this parameter to the service. There are several ways to achieve this e.g. CommandLineRunner
, ApplicationRunner
, or as mentioned on href="https://stackoverflow.com/questions/49698963/how-to-call-a-service-from-main-application-calls-spring-boot?answertab=trending#tab-top">this thread.
However, I am confused about the most proper way as some suggestions are really too old. As I am using the latest version of Spring with Java 17, what is the most proper way to read user input and pass that parameter to the Service?
Solution
Both ways that you write can still achieve this and in real life projects you never user console apps. So you can use them to this for your tests and learning projects.
Answered By - knowNothing
Answer Checked By - Marie Seifert (JavaFixing Admin)