I'm launching a spring-batch
job on application start using
spring.batch.job.names=MyJob
@Configuration
public class MyJob {
@Bean
public Job testJob() throws IOException {
return jobBuilderFactory.get(MyJob.class.getSimpleName())
.start(import())
.build();
}
}
Unfortunately this somehow delays the tomcat
server startup. The job has a runtime of several minutes, thus I'm getting the following error:
Server Tomcat v8.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
Question: how can I run this job without preventing tomcat to start up? Eg running the job async?