Define an in-memory JobRepository

With SpringBoot 2.x, the solution is simpler.

You have to extend the DefaultBatchConfigurer class like this:

@Component
public class NoPersistenceBatchConfigurer extends DefaultBatchConfigurer {
    @Override
    public void setDataSource(DataSource dataSource) {
    }
}

Without datasource, the framework automatically switches to use the MapJobRepository.

Leave a Comment