0

I use spring batch in a spring boot application (2.5.3).

In my properties I put theses two line to avoid to create db tables

spring.batch.jdbc.initialize-schema=never
spring.batch.initialize-schema=never

In my Config class, I have

@Bean
public Job lastConsentBatchJob() {
    return this.jobBuilderFactory.get("lastBatchJob")
            .incrementer(new RunIdIncrementer())
            .flow(lastConsentBatchStep())
            .end()
            .build();

}

@Bean
public Step lastConsentBatchStep() {
    return this.stepBuilderFactory.get("lastBatchJob").<LastDto, LastDto>chunk(1)
            .reader(reader())
            .writer(writer(null)).build();
}

Why when I lunch application, spring launch this query

SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
robert trudel
  • 5,283
  • 17
  • 72
  • 124
  • 1
    Spring Batch by default uses a database to store information about job execution. You can't remove this but you could use MapJobRepository. Is that what you are looking for? – Simon Martinelli Aug 12 '21 at 15:42

1 Answers1

0

spring.batch.jdbc.initialize-schema=never prevents from launching script that initialize tables creation for Spring

This query is not part of this script, it tries to retrieve transaction information in the supposedly created tables

It is possible to disable transaction management using ResourcelessTransactionManager, but it is not recommended for production environnements

ACH
  • 185
  • 11