I'm trying to create Spring Batch process to read Oracle DB and use the data to send out some emails. For Batch repo I want it to use H2 database as I don't want to add new tables into our main database. So far I have not managed to get the process running my job. It just silently closes after launch. I checked out the gs-batch-processing sample that works normally, but as soon as I extend the configuration class with DefaultBatchConfiguration, it stops executing the job and does nothing.
@Configuration
public class BatchConfiguration extends DefaultBatchConfiguration
What is the missing part, that would enable again the job's automatic start in this case?
Found the solution - you need to declare @BatchDataSource bean:
@Bean("batchDataSource")
@BatchDataSource
public DataSource batchDataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.addScript("/org/springframework/batch/core/schema-drop-h2.sql")
.addScript("/org/springframework/batch/core/schema-h2.sql")
.generateUniqueName(true)
.build();
}