I have a Spring Batch application, which I start with the CommandLineJobRunner
. But now I have to embed this application into our corporate environment. There we have an own Launcher application which I have to use. For this launcher application I need a startup class with a main method which will be called at startup and where I would have to launch Spring Batch.
Is the only way to manually assign a JobLauncher
and run the Job with this launcher or is there a class in Spring Batch which would support that (or do someone know a sample)?
Yes, you can launch your job programmatically. If you see in the source of CommandLineJobRunner
, the main method just create a Spring context and use the launcher to run the job. So you can do this in your new application.