java spring spring-batch spring-boot

How Spring Boot run batch jobs

I followed this sample for Spring Batch with Boot.

When you run the main method the job is executed.
This way I can’t figure out how one can control the job execution. For example how you schedule a job, or get access to the job execution, or set job parameters.

I tried to register my own JobLauncher

public JobLauncher jobLauncher(JobRepository jobRepo){
SimpleJobLauncher simpleJobLauncher = new SimpleJobLauncher();
return simpleJobLauncher;

but when I try to use it in the main method:

public static void main(String[] args) {
ConfigurableApplicationContext ctx =, args);
JobLauncher jobLauncher = ctx.getBean(JobLauncher.class);
//try catch removed for readability, new JobParameters());

The job is again executed when the context is loaded and I got JobInstanceAlreadyCompleteException when I try to run it manually.
Is there a way to prevent the automatic job execution?