Home > other >  Spring Boot Console app: How to pass input to service?
Spring Boot Console app: How to pass input to service?

Time:08-22

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 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?

CodePudding user response:

Both ways that you write can still achieve this and in real life projects you never use console apps. So you can use both of them to this for your tests and learning projects.

  • Related