I have a spring boot application which has 2 modules to it. First is a web module that exposes a rest API which allows users to some data into the application. Second module is set of batch jobs that act on these configurations and perform background processing.
I was able to create both REST API and batch jobs in the application and as a starting point, I used a REST end point to kickoff my batch jobs using JobLauncher.
My next task is to package the application and deploy the web application to expose REST endpoints and also create shell scripts to kick off the batch jobs using an enterprise scheduler.
I am Using Maven and spring-boot-maven-plugin to build the executable jar.
When I execute
java -jar myApp.jar
REST APIs are getting exposed however, when I try to run the batch jobs by executing
java -cp myApp.jar org.springframework.batch.core.launch.support.CommandLineJobRunner com.example.myJobConfig job1 runDate=2020-02-29
I get the following error Error: Could not find or load main class org.springframework.batch.core.launch.support.CommandLineJobRunner
I am looking for help on how I can have both web app and batch jobs in a single application and launch the batch jobs using a shell script.