【发布时间】:2021-10-16 00:00:48
【问题描述】:
我在 Spring Boot 应用程序 (2.5.3) 中使用 Spring Batch。
在我的属性中,我放了这两行以避免创建数据库表
spring.batch.jdbc.initialize-schema=never
spring.batch.initialize-schema=never
在我的 Config 类中,我有
@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();
}
为什么当我午餐应用程序时,春天启动这个查询
SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
【问题讨论】:
-
Spring Batch 默认使用数据库来存储有关作业执行的信息。您无法删除它,但可以使用 MapJobRepository。这就是你要找的吗?